March 29, 2013

Install LAMP (Linux Apache MySQL PHP) & Drupal

PART 0 - DOWNLOAD DRUPAL
  1. Download the latest Drupal from here.
PART 1 - INSTALLING & CONFIGURE LAMP (Linux Apache MySQL PHP)
STEP 1 - Installing APACHE
  1. Open a terminal and type:
  2. sudo apt-get install apache2
  3. To make sure that Apache is installed open a web browser and type:
  4. http://localhost
  5. You should see something like this:
STEP 2 - Installing PHP
  1. Again open a terminal and type:
  2. sudo apt-get install php5 libapache2-mod-php5
  3. Now you must restart Apache:
  4. sudo /etc/init.d/apache2 restart
  5. To ensure that there are no issues with PHP run:
  6. sudo gedit /var/www/testphp.php
  7. A file called testphp.php will open.
  8. Copy and paste the following into the testphp.php
  9. 
    
  10. Save the file and exit
  11. Now open a web browser and type:
  12. http://localhost/testphp.php
  13. If it works then PHP is installed!
STEP 3 - Installing MySQL
  1. Open a terminal and type:
  2. sudo apt-get install mysql-server
  3. The above command will install MySQL
  4. Now comes the tricky part!
  5. Log in MySQL by typing:
  6. mysql -u root -p
  7. Now you need to set a password (Change yourpassword with the password you want. Do not remove ' '. Type your password between ' '.)
  8. SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
  9. For example:
  10. SET PASSWORD FOR 'root'@'localhost' = PASSWORD('12345');
  11. The next step is installing phpMyAdmin (A tool for editing your databases)
  12. sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
  13. Now you must edit the php.ini file in order to get PHP to work with MySQL
  14. gksudo gedit /etc/php5/apache2/php.ini
  15. Uncomment the following line by removing the semicolon (;)
  16. ;extension=mysql.so
  17. For example:
  18. extension=mysql.so
  19. Finally restart Apache:
  20. sudo /etc/init.d/apache2 restart
That's it your web server is up and running!
PART 2 - DRUPAL
  1. Open a terminal and type:
  2. sudo gedit /etc/apache2/apache2.conf
  3. apache2.conf will open
  4. In order for Drupal to functioning properly with Apache and PHP type the following at the the end of the file:
  5. AddType application/x-httpd-php.html
  6. Click Save
  7. Now it's time to create a Database
  8. Type the following and enter your password:
  9. mysql -u root -p
  10. To create a Database type:
  11. //Use whatever name you like instead of drupal
    CREATE DATABASE drupal;
  12. Now you need to create a user
  13. CREATE USER yourname@localhost;
  14. Finally define a password for the newly created user
  15. SET PASSWORD FOR yourname@localhost = PASSWORD('yourpassword');
  16. Now you need to grand permissions for the user
  17. GRANT ALL PRIVILEGES ON drupal.* TO yourname@localhost IDENTIFIED BY 'yourpassword'
  18. Go to the location that your Drupal was downloaded in PART 0 and unpack it
  19. Then copy the unpacked Drupal folder to /var/www/
  20. cp /home/user/Downloads/drupal-7.21 /var/www/
  21. Now head to /var/www/ and change directory to drupal
  22. cd drupal-7.21
  23. Change the permissions
  24. sudo chmod a+w sites/default
    cd sites/default
  25. Copy default.settings.php to settings.php
  26. cp default.settings.php settings.php
  27. Change the permissions
  28. sudo chmod a+w settings.php
  29. Finally create a directory named files
  30. sudo mkdir files
  31. and change permissions
  32. sudo chmod a+w files
  33. That's it!
  34. Now open a web browser and type:
  35. http://localhost/drupal-7.21
  36. Finally follow the on screen Drupal instructions to install Drupal

No comments:

Post a Comment