Tuesday, January 27, 2015

[Ubuntu]: Create Your Website Using Drupal In Ubuntu 14.10

Create Your Website Using Drupal In Ubuntu 14.10

If you want to create your own website Free , Fast and Easy, Drupal is the best solution for your needs.
Drupal is an open source content management platform powering millions of websites and applications. It’s built, used, and supported by an active and diverse community of people around the world that’s why Drupal remains a popular choice today.
For more information check this link: https://www.drupal.org.
In this guide, we will describe how to install and configure Drupal on an Ubuntu 14.04 server.

Prerequisites

This guide is based on Ubuntu 14.04 server. Before you start install of Drupal, you need to to have LAMP server(Apache, PHP, and MySQL) configured on your website server.
sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-gd php5-curl libssh2-php
While Apache, PHP, and MySQL have already been installed, you can start the installation.

Database and MySQL user creation for your website

You start the creation of your website by setting up the mysql user and database.
You need to have the password of the MySQL root user.
Log into MySQL:
mysql -u root -p
After successful authenticated, you need to create the database for the Drupal Website.
CREATE DATABASE drupal;
The database Name is drupal. You will need this inforamtion later.
Now, you should create the database adminstrator.
CREATE USER drupaladmin@localhost IDENTIFIED BY 'drupalpassword';
Next, you need to give this user  permissions to administer the database you created.
GRANT ALL PRIVILEGES ON drupal.* TO drupaladmin@localhost;
You need to flush the privilege information to disk to activate the new MySQL user:
FLUSH PRIVILEGES;
exit

PHP and Apache Configuration

Next, you need to make some configuration in PHP Apache file.
Open the Apache PHP configuration file with sudo privileges in your text editor:
sudo nano /etc/php5/apache2/php.ini
Search for the expose_php directive and the allow_url_fopen directive and set them both to “Off”:
. . .
expose_php = Off
. . .
allow_url_fopen = Off
. . .
Save and close the file when you are finished.
Next, you need to enable rewrite functionality for your Apache server.
To enable mod_rewrite modules , type this command:
sudo a2enmod rewrite
This module will be enable the next after reboot of Apache service.
But before restarted the Apache service, you need to make some change in the virtual host file to allow the use of an .htaccess file.
So, open the virtual host file which contain the actual rewrite rules and will includ by default in the Drupal installation.
sudo nano /etc/apache2/sites-enabled/000-default.conf
In this file, you must add a directory block that redirect into your web root.
Maybe you need also ServerName directive to point to your domain name and change the ServerAdmin directive to reflect a valid email address:
<VirtualHost *:80>
   ServerAdmin admin@your-domain.com
   DocumentRoot /var/www/html/
   ServerName your-domain.com
   ServerAlias www.your-domain.com
      <Directory /var/www/html/>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
  Order allow,deny
         allow from all
      </Directory>
   ErrorLog /var/log/apache2/your-domain.com-error_log
   CustomLog /var/log/apache2/your-domain.com-access_log common
</VirtualHost>
After finished this step, to enable the new configuration you need to restart your Apache server .
sudo service apache2 restart

Download and Install the Drupal Files

Now that our system is ready, we can start the installation of Drupal into our web root.
Go to the Drupal download page and checkout the latest version under the “Recommended releases” section. Right click on the tar.gz link of the version you are interested and choose “copy link address”.
Back on your server, change to your tmp directory and use wget to download the project file using the link you copied:
cd /tmp
wget http://ftp.drupal.org/files/projects/drupal-7.32.tar.gz
once the download is finished start the process by , extracting the application directory using this commandr:
tar xzvf drupal*
Now, you need to copy  the newly extracted directory structure into the web root directory of your server and it’s recommanded to use the rsync utility to safely copy all of the files into the web root directory of your server. We are using the dot in this command to specify the current directory. This is necessary in order to copy some hidden files that we need:
cd drupal*
sudo rsync -avz . /var/www/html
Now you can check that has been copied, into the web root directory.
cd /var/www/html
ls -lsa
Make the document root and the Drupal files and directories in it writable by the Apache service which is running as user ‘www-data’ and group ‘www-data’ by executing the following command:
chown www-data:www-data -R /var/www/html/
Before we start the web configuration part, we need to restart Apache service.
service apache2 restart

Web-based Installation Step

Now proceed to the web installation of Drupal. Go to the URL http://server_domain_or_IP_Address
Proceed with Standard and hit Save and continue.
drupal1
Now by default English is selected, continue with Save and Continue:
2
Now you need to give the  database information login and password as you configured it.
In our case, we made a database called drupal, a database user named drupaladmin, and a password of password.
Click “Save and continue” again when you have filled in your database details
3
Next, you need to set up some basic information about your site. Fill in the fields using appropriate values for your site:
4
Click the “Save and Continue” button a final time to complete the installation.
5
Congratulations, You have successfully completed the Drupal installation.
You can now visit your site by going to your domain name or ip address of your server.
6

Add New User Account In Drupal

After completed the installation, if you want to add new user account or make some change in administrator account. Drupal allows you to setup any number of different kinds of users or ‘Roles’.
You need to go under to the page People ==> Add User
7
After click on  Add user, you need to fill in the fields as required.
8
Once you create the account, if you select the checkbox option labeled Notify user of new account, an email will be sent to the new user.

Change Theme In Drupal

There are a lot of quality contributed Drupal themes available that can be found athttp://drupal.org/project/themes
You can probably find one that will suit your needs for the most part within the first few pages of this listing.
To install the new theme , simply perform the following steps:
1- Using the top menu area, click on the Appearance option.
10
2- Click on Install new Theme. In this step you need to copy the link of your theme or to download it in your pc and after that upload from your browser.
11
After Click on Install , your theme will be installed on your website.
12
After successfully completing the installation of your theme, you need to enable it and set ip as default theme.
To enable a different theme, simply scroll down to theme of your choice and click on the link labeled Enable and Set Default.
15
In this example, I will select the Berry theme to be my new default.
After clicking on the link, the screen refreshes to display the newly selected theme at the top. Visiting your site, you will now see the new layout based on the theme you selected.
16
Congratulations! You now create your own website on your Ubuntu 14.10 !

No comments: