Tuesday, September 7, 2010

Setting up a full CentOS webserver in only 5 commands. It will be easy and requires almost no expertise.

After some searching, I realized that it is really easy because Linux CentOS 5 comes pre-bundled with Yum. Yum is a feature that allows you to download and install software automatically. It will determine all of the dependencies and take care of the rest. I determined which packages I needed and sent off my command:

yum install php php-mysql mysql-server php-gd postgres ImageMagick ImageMagick-devel

This determined all of the dependencies and installed PHP and Mysql on my CentOS Linux server! It was so easy!! I just needed to give Apache a reboot and php was pretty much up and running. To give it a test, I just wrote a simple line of code in /var/www/html/test.php.

phpinfo();

Then visit yourhost/test.php If your php server is setup correctly, this should output all of the information about your php install and the different components that were installed with it. It will give you a list of all your configurations and plugins that are enabled.

The next step was getting mysql up and running. After the yum install, the daemon is not automatically started so you will need to start it yourself. You can start the mysql daemon but running the following command:

service mysqld start

If everything goes well, the service should start without a hitch and it will give you a list of directions for first time users. One of the most important things to do now is to set a password for the root user in mysql. Again just like everything else it is just a simple 1 liner to change the mysql password:

/usr/bin/mysqladmin -u root password 'mynewpassword'

Thats it! After only a few simple commands in Linux, I was able to get a bare-boned CentOS 5 system up and running with a full LAMP install. This process will take a max of 5 minutes to complete. But for me.. I was busy googling it took me about 30 minutes to an hour.. so hopefully this will help you.

No comments:

Post a Comment

My Mine