Wednesday, November 12, 2014

Drupal7 Installation and Website Development

For installing drupal7 we need to install LAMP(Linux, Apache, MySql, Php) server. I am assuming that you already installed any Debian based Linux(L) OS like Ubuntu. Run the following commands in terminal to install LAMP server.

Installing Apache(A):

To install apache2 run following command.

- sudo apt-get install apache2

To check apache2 installed, type the URL http://localhost/ in web browser.

Installing Php(P):

To install Php5 run following command.

- sudo apt-get install php5 libapache2-mod-php5

- sudo /etc/init.d/apache2 restart

To check php5 installed properly or not, create test.php in /var/www/ with code shown in screenshot.

Now type http://localhost/test.php in web browser, it will display the information of installed Php as shown in following screenshot.

Installing MySql(M):

To install MySql run following command in terminal.

- sudo apt-get install mysql-server

During MySql server installation do not forget to enter root user password.

Run following command to install phpadmin in terminal.

-  sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

During phpadmin installation select apache2 as default to run phpadmin using apache2, by pressing space tab as shown in screenshot.

During phpadmin installation setup required passwords also.

Now LAMP server is installed. Do the following settings also.

- Uncomment in /etc/php5/apache2/php.ini file as shown in following screenshot.

- Add  ServerName localhost in /etc/apache2/httpd.conf file.

Creating Required MySql Database:

 Log into MySql using following command

- mysql -u root -p

Then create Required database using following command

- create database drupaldb;

Then create a user to access that database using following command

- create user 'user1'@'localhost';

Set password for created user user1

- update mysql.user set password=password('PassWord') where user='user1';

Grant all privileges to user1 on drupaldb using following command

- grant all privileges on drupaldb.* to 'user1'@'localhost';

Then flush all privileges using following command

- flush privileges;

Installing Drupal7:

Download drupal7 using following command

- wget

Now move downloaded drupal-7.23.tar.gz to /var/www/drupalsite folder and extract there itself. You need to create drupalsite folder in /var/www/. Change the owner of drupalsite by running following command.

- chown -r www-data.www-data drupalsite

Now make sure your apache HTTP listens to port 8001 (if you want you can use any other port also). To listen port 8001, enter Listen 8001 in /etc/apache2/ports.conf file as shown in following screenshot.

Now copy the contents of /etc/apache2/sites-available/default to /etc/apache2/sites-available/drupalsite and add the content shown in following screenshot to /etc/apache2/sites-available/drupalsite file.

Now run the following bunch of commands to take affect of made changes / settings.

- sudo a2ensite /etc/apache2/sites-available/drupalsite
- sudo /etc/init.d/apache2 reload
- sudo a2enmod vhost_alias rewrite
- sudo /etc/init.d/apache2 reload

 Now whatever setup needed for installation of drupal7 is ready. Type http://localhost:8001/install.php URL in web browser and you will see the page as shown in following screenshot.

Now click on Save and continue, in the next screen select english as language. After that, in database configuration enter database details, which you have created in mysql as shown in following screenshot.

In the next step enter all the details like site name, site maintenance e-mail and site maintenance account details.

 Once you enter the above details your drupal site is ready.

Now click on Visit your new site to see your site.

Now your basic drupalsite is ready. By using your site maintenance account you can create new content, new modules etc. is an example site developed using drupal7.

No comments:

Post a Comment