(ve):Install LAMP on Fedora 12
- This page was last modified on March 8, 2011, at 11:48.
From (mt) Community Wiki
Contents |
Install
- Log in to your (ve) server as root or another user with sudo privileges:
ssh root@example.com
- Make sure your server is up to date:
yum update
Apache
For this example, the IP is 12.34.56.78 and the domain is ve-server1.com. Be sure to change these values to yours. The NameVirtualHost line is your IP address, which you can easily find in your AccountCenter Server Guide.
- Install the latest version of Apache.
yum install httpd
- Next, we need to create a vhost.conf file in /etc/httpd/conf.d/:
touch /etc/httpd/conf.d/vhost.conf
- Then, we need to add the following code:
/etc/httpd/conf.d/vhost.conf
NameVirtualHost 12.34.56.78:80 <VirtualHost 12.34.56.78:80> ServerAdmin webmaster@ve-server1.com ServerName ve-server1.com ServerAlias www.ve-server1.com DocumentRoot /var/www/ve-server1.com/html/ ErrorLog /var/www/ve-server1.com/logs/error.log CustomLog /var/www/ve-server1.com/logs/access.log combined </VirtualHost> - Now we will create the directory for the site:
mkdir -p /var/www/ve-server1.com/{html,logs} - We will create a test file to make sure things are working correctly.
echo '<html><head><title>ve-server1.com</title></head><body><h1>Hello, World!</h1></body></html>' > /var/www/ve-server1.com/html/index.html
- Then let's configure Apache to start at boot-up.
chkconfig --levels 235 httpd on
- Now start Apache:
/etc/init.d/httpd start
We should now be able to point our browser to the IP address to see the default "Hello, World!" page: IMAGE GOES HERE
MySQL
- Run this command to install MySQL:
yum install mysql mysql-server
- Then we'll configure the system startup links for MySQL. We want MySQL to start automatically whenever the system boots and start the MySQL server:
chkconfig --levels 235 mysqld on /etc/init.d/mysqld start
- The following command will walk you through setting your MySQL root password, removing anonymous users, disabling remote root access, and removes the test database. Remember to choose a strong password. Read our article on Strong password guide.
mysql_secure_installation
PHP
- Use this to install PHP5 and the Apache PHP5 module:
yum install php
- Then restart Apache
/etc/init.d/httpd restart
- Next, let's add MySQL support in PHP by adding the php-mysql package. This is where/when you would also add any PHP modules. If you're looking for more PHP modules you can run a search:
yum search php
- You can install whichever modules you wish, including PHP MySQL support, like this:
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
- Once again, restart Apache
/etc/init.d/httpd restart
Security
Follow these articles to make your server more secure:
- Securing your (ve) Server
- (ve):Secure Apache configuration
- (mt) Security Resources (browse for applicable articles)