Centos Home Server

Centos Home Server Setup

A Centos Linux Home Server can easily be built after installation. Using Centos as a Linux Home Server is an excellent option because it is free and it is commonly used for web hosting. Based on Red Hat, Centos is the Linux variant which can run Cpanel at hosting data-centers. Therefore, using it will help you be familiar with its file system. Since Linux file systems vary from variant to variant, using Centos at home can make using command lines and running a VPS or dedicated server much easier. This tutorial will explain how to turn the newly installed Centos Installation into a home server which can host a website like example.com.

Install Apache, mySQL and PHP

4) Install mySQL.
a) $ yum install mysql-server mysql php-mysql  
b) Select Yes(y) when necessary.

b) /etc/init.d/mysqld start

5) Login to mySQL to check it out
a) # mysql > Enter
Now, you have access to the mySQL console and can create and edit any database.
b) To leave mySQL type:
mysql>exit

6) Install php
a) #yum install php
a) Select Yes(y) when necessary

7) Restart the Apache service.
a) # service httpd start 



[root@livedvd local]# cd /etc/httpd/conf/httpd.conf
Open the file in text editor and scroll to the bottom
Add: Include conf/conf/*.conf

[root@livedvd conf]# mkdir conf
[root@livedvd conf]# ls
conf  httpd.conf  magic

open conf/example.com.conf

<VirtualHost *:80>
        ServerName www.example.com
        ServerAlias example.com *.example.com
        DocumentRoot /var/www/example.com

        <Directory "/var/www/example.com">
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

Set the dns to point to your ip. You can do this with an online hosting account or free service like free dns. 

[root@livedvd www]# cd /var/www
[root@livedvd www]# mkdir example.com
[root@livedvd www]# ls

Just add an index.html or index.php file to the folder and open the website in the browser. You should see your website hosted from home.