Recently, I had to setup a LAMP environment on a temporary CentOS 5.6 Linux server. (CentOS is the open source equivalent to the Red Hat Linux operating system.) Pleasantly, using Yum (Yellow dog Update, Modified), which is the CentOS and Red Hat RPM package manager, makes the task super simple. I did the following tasks while logged into a SSH shell as the root user.
Note: CentOS does not officially support the Sun Java SDK due to a licensing issue (I think). You will need to go through some hoops to get Sun Java SDK working on the CentOS. I attempted to install the latest JDK by downloading and executing the .bin, but it failed with dependency errors. I found this alternative approach, Installing Java (Sun JDK 1.6.0) on CentOS 5, but couldn’t complete it because my CentOS server started throwing segmentation faults and freezing (probably due to OS corruption or a hardware issue).
Change Hostname (Optional)
Run the command line tool “system-config-network” to change the hostname entry. This tool will update “/etc/sysconfig/network” and “/proc/sys/kernel/hostname”. You can run the “hostname” command to double-check.
Install MySQL
Run the following commands:
yum install mysql
yum install mysql-devel
service mysqld start
chkconfig mysqld on
The last two commands will start the MySQL server and configure it to run on boot.
Install Apache
Run the following commands:
service httpd start
chkconfig httpd on
The Apache Server will have HTTPS/SSL access enabled by default. However, it will use the same htdocs directory “/var/www/html” as the HTTP. To change the HTTPS to use a different document root directory, edit the “/etc/httpd/conf.d/ssl.conf” and add the following:
<Directory "/var/www/html-ssl">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
To have the change take effect, restart the Apache Server by running “service httpd restart”. Check the “/var/log/httpd/ssl_error_log” for errors specific to the HTTPS service.
Install PHP
Run the following commands:
yum install php-mhash php-mysql php-xml
(You can combine the above packaged into one line if you wish to.)
If you need json_encode and json_decode methods, you will need to install the PHP JSON package. Unfortunately, the CentOS 5.6 Yum installs PHP 5.1 so you cannot run “yum install php-json” because it requires PHP 5.3. To install the JSON package onto PHP 5.1, run the following:
echo "extension=json.so" > /etc/php.d/json.ini
service httpd restart
Good luck and have fun!
The info above is consolidated from:
Owww amigo, voce foi demais passei noites pesquisando e gastando dinheiro com linode e nada dava certo mas com esses seus comandos deu tudo certinho que foi uma maravilha. Obrigado mesmo! Fica com Deus.