Setup LAMP Server on Ubuntu (Linux-Apache-Php-MySQL)

This command line with build a fully functionnal LAMP Server, with MySql DB, imagemagick and php5.

Install Apache 2

Code: Select all
sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server mysql-admin php5-mysql php5-gd imagemagick

Restart Apache 2

Code: Select all
sudo /etc/init.d/apache2 restart

Edit MySql config to allow remote access

Code: Select all
nano /etc/mysql/my.cnf

add Comment in line #host=127.0.0.1
Setup MySql local root password

Code: Select all
mysqladmin -u root password 'rootpassword'

Log as root on MySql Server

Code: Select all
mysql -u root -p

Create a Remote access user

Code: Select all
grant all privileges on *.* to 'remote'@'%' identified by 'yourpassword' with grant option;

Flush all privileges in the DB

Code: Select all
flush privileges;

Restart Apache & MySql command

Code: Select all
sudo /etc/init.d/mysql restart
sudo /etc/init.d/apache2 restart

To fix apache2: Could not reliably determine the server’s fully qualified domain name error

Code: Select all
nano /etc/apache2/apache2.conf

add the line

Code: Select all
ServerName localhost

Setup the FTP Server
default apache folder is /var/www

Code: Select all
sudo apt-get install vsftpd

Edit vsftpd config file

Code: Select all
nano /etc/vsftpd.conf

The follow line must be like that

Code: Select all
#anonymous_enable=YES
local_enable=YES
write_enable=YES

Then add you local user to access your ftp

Code: Select all
adduser www
passwd www
usermod -d /var/www www
chmod 777 -R /var/www
chgrp www /var/www

then you can access the server in ftp://ip users www passw www

Tweak
Php Config File

Code: Select all
nano /etc/php5/apache2/php.ini

Apache Conf File

Code: Select all
nano /etc/apache2/apache2.conf

MySql Config File

Code: Select all
nano /etc/mysql/my.cnf

VsFtpd Config File

Code: Select all
nano /etc/vsftpd.conf

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: