Installing Drupal In Linux
Hello!
This is my first technical blog. This blog would make you understand how to setup LAMP and build Drupal locally.
Contributing to Drupal:
To contribute to Drupal we need to first build it on our localhost. So now let us discuss how to build Drupal on our localhost.STEP 0
Get into www.drupal.org and sign up for Drupal and then create an account in Drupal Ladder and complete the ladder simultaneously.STEP 1
Installing Git. Install git using the given commands. For Linux users:$ sudo apt-get update $ sudo apt-get install git
STEP 2
Installing Composers Dependencies.
The composer is a dependency manager for PHP. The composer will manage the dependencies you require on a project by project basis. This means that Composer will pull in all the required libraries, dependencies and manage them all in one place.$ sudo apt-get update $ sudo apt-get install curl php-cli php-mbstring git unzip
Installing and configuring Composer
$ cd ~ $ curl -sS https://getcomposer.org/installer -o composer-setup.phpTo install composer globally, use the following command :
$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composerThe output should be something like this:
Output All settings correct for using Composer Downloading 1.1.1... Composer successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composerTo test whether the composer is working or not please enter :
$ composerThen you should be getting something like this: Output
______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 1.1.1 2016-05-17 12:25:44 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. . . .
STEP 3
Installing Drush
$ composer global require drush/drush:8.*Navigate to the Drupal directory using the cd command and then type:
$ drush core-statusThis should return the version of the Drush. Here comes the main part of our build.
STEP 4
Installing LAMP/WAMP
This is the major step of our build which involves installing lamp and configuring it.LAMP is an open source Web development platform that uses
Linux as the operating system,
Apache as the Web server, MySQL as the relational database management system and
PHP as the object-oriented scripting language.
Installing Apache
We can get started by typing these commands:$ sudo apt-get update $ sudo apt-get install apache2Press Y and hit Enter to continue, and the installation will proceed. To check for errors please type:
$ apache2ctl configtest
You should be getting something like this if everything is working fine:
Run a simple security script that will remove some dangerous defaults and lock down access to our database system. For that type:
Output Syntax OKRestart Apache to implement your changes:
$ systemctl restart apache2To check everything is working fine in your browser :
http://your_server_IP_addressYou should get the Ubuntu start page which looks like this: If you see this page, then your web server is now correctly installed and accessible through your firewall.
Installing MySQL
Now we have to install MySQL-Structured Query Language by entering the command :$ apt-get install mysql-serverTo get our MySQL environment set up securely we need to tell MySQL to create its database directory structure where it will store its information. You can do this by typing:
$sudo mysql_install_db
$ sudo mysql_secure_installationAt this point, your database system is now set up and we can move on.
Installing PHP
This should install PHP without any problems.$ sudo apt-get install php5 libapache2-mod-php5 php5-mcryptApache will first look for a file called index.html. We want to tell our web server to prefer PHP files, so we'll make Apache look for an index.php file first. To save all the changes we have done restart apache2:
$ sudo service apache2 restartThis is how you Install LAMP. If you face any errors then try the single line command to install Lamp along with phpmyadmin:
$ sudo apt-get install lamp-server^ phpmyadmin
This will automatically configure lamp on your desktop.
STEP 5
Configuring phpmyadmin
After installing phpmyadmin with the command$ sudo apt-get update $ sudo apt-get install phpmyadminWhich will open the below screen.... Then select yes to continue configuring phpmyadmin Then set up a password for your root user Once this step is done, you will find that a new database named phpmyadmin is created. To save your changes reload apache2.
$ sudo systemctl reload apache2To check phpmyadmin is working please open the given address in your browser. Now log on to it using the root username with the same password you gave for MySQL.
STEP 6
Clone Drupal8
After logging in we have to clone the Drupal repository.$ cd /var/www/html $ git clone --branch 8.5.x http://git.drupal.org/project/drupal.git drupal8
STEP 7
Now as you have cloned the website into your localhost. Now create a database named Drupal in phpmyadmin. Now open in your browser :localhost/name_of_sitewhich should give you this page:
STEP 8
The main requirements will be Solve the above error by copying the information from /sites/default/default.settings.php to /sites/default/settings.php You have to give read and write permissions to the files directory in sites/default folder. Now create a file named โfilesโ. Then using the below command, give read and write permissions. For this, use:$ cd sites/default $ mkdir files $ chmod 777 filesThese are the basic requirements and then click on continue anyway and then you get the next page as: Complete the process as shown above and then do the next step to see your Drupal website on your localhost.
STEP 9
Now you have your website on your localhost. To check it please type:localhost/site_nameCongratulations !!! You have successfully installed and built Drupal on your localhost. Please give your suggestions and comments below and post your doubts too.
Subscribe to FOSS-BLOG
Get the latest posts delivered right to your inbox