Install drupal through command line step by step

Download and extract files

$  wget https://www.drupal.org/files/projects/drupal-x.x.tar.gz
$  tar -zxvf drupal-x.x.tar.gz

Move to root folder

$  mv drupal-x.x /var/www/html

Create the configuration file and grant permissions

In the sites/default directory, copy the default.settings.php file and rename the copied file to settings.php.

$ cp sites/default/default.settings.php sites/default/settings.php

Give the web server write privileges (666 or u=rw,g=rw,o=rw) to the configuration file.

$ chmod a+w sites/default/settings.php

Give the web server write privileges to the sites/default directory.

$ chmod a+w sites/default

Create the Drupal database

To complete the installation, you must create an empty database and a user with full access to the newly created database for Drupal to use. You can do this by command line, or through phpMyAdmin or another database client.

$ mysqladmin -u username -p create databasename

Where ‘username’ is a MySQL user which has the CREATE and GRANT privileges. MySQL will prompt for the ‘username’ database password. Next you must set the access database rights. Log in to MySQL:

$ mysql -u username -p

$ GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON databasename.* TO ‘username’@’localhost’ IDENTIFIED BY ‘password’;

Run the installation script

Point your browser to the base URL of your website

http://www.example.com

Advertisement

Why ‘sudo’ command use in linux ?

In Ubuntu Linux there is not root account configured by default. If users want root account password then they can manually set it up can use ‘sudo’.

‘su’ Vs ‘sudo’

‘su‘ forces you to share your root password to other users whereas ‘sudo‘ makes it possible to execute system commands without root password. ‘sudo‘ lets you use your own password to execute system commands i.e., delegates system responsibility without root password.

Ubuntu basic commands

Below specified basic Ubuntu commands

Change owner

sudo chown user_name modules/ 
Using this command change owner for a particular folder.

sudo chown -R user_name modules/ 
Using this command change owner for a folder along with inner files recursively.

Change permissions 

sudo chmod 777 default/ 
Using this command change permissions for a particular folder or file.

sudo chmod -R 777 default/ 
Using this command change permissions for a folder along with inner files recursively.

Change directory

$ cd default

Goto previous directory

$ cd ..

Get current cirectory

$ pwd