CentOS 5 server pt 3

So we have learn how to install a server from previous part 1 and part 2. We have set up a server using CentOS. Still I can't run my web can I? So in part 3 I'm going to show how to set up my Apache webserver, MySQL database and PHP language.

Let us install the Apache web server. Type in yum install httpd. Usually it is already installed. Since you have update the system, I guess your apache is also updated. Mine did.

Now lets configure our system to start Apache at boot. So that we don't have to start the webserver manually and then turning it on.

chkconfig --levels 235 httpd on
/etc/init.d/httpd start

Next is to install MySQL, type the following commandment to install MySQL. Like mine already installed and updated eventhough I type the command.

yum install mysql mysql-devel mysql-server
Like apache, MySQL doesn't starts automatically whenever the system boots. So to make MySQL server start at boot time this is what we do.

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
Now let us check that networking is enabled by run


netstat -tap | grep mysql


If it doesn't, edit /etc/my.cnf and comment out the option skip-networking:


nano /etc/my.cnf
#skip-networking
/etc/init.d/mysqld restart

Run as below if you want to set a password for your MySQL. Let me give a suggestion. Don't need it. Why? We just setting up for test only and not for uploading on general viewing. I actually don't need any password but if you thing a password is needed then set up your password as below.
mysqladmin -u root password <password>
mysqladmin -h server1.example.com -u root password <password>

Where is your password without the < or >.
Install the requirements for php by typing:

yum install php php-*
Then edit /etc/httpd/conf/httpd.conf:
nano /etc/httpd/conf/httpd.conf
and change the DirectoryIndex to

DirectoryIndex index.html index.htm index.php index.php3
Restart again your Apache server by /etc/init.d/httpd restart and MySQL server by /etc/init.d/mysqld restart .


Revise Back Part 1
Revise Back Part 2
Continue Part 4

Comments

Popular Posts