Installing drupal on a local machine

Running drupal on your local machine will be easy to learn how to use drupal. Moreover, there is no expense to install it like we do in web hosting.

Pre-requisites

Git should be installed and configured on your machine. If not done, then follow these commands –

$ sudo apt-get install git #installing git
$ git config --global user.name "<username>"        
$ git config --global user.email <email>

Also, you need to install composer before going to the next step. For that follow this one line code –

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Some more things to install

sudo apt-get install php5-gd php5-curl libssh2-php

Now you need to install and setup lamp server on your local machine. For that follow my previous post -> Installing LAMP server on ubuntu

Also you need to do some configurations with your apache files and mysql.

First thing is to create a database

mysql -u root -p

CREATE DATABASE drupal;

CREATE USER drupaluser@localhost IDENTIFIED BY 'password';

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER,CREATE TEMPORARY TABLES,LOCK TABLES ON drupal.* TO drupaluser@localhost;

FLUSH PRIVILEGES;

exit

Now configure apache file –

sudo nano /etc/php5/apache2/php.ini

Check the below conditions are given correctly –

. . .
expose_php = Off
. . .
allow_url_fopen = Off
. . .
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-enabled/000-default.conf

Check whether the below codes match with the file you opened now

<VirtualHost *:80>
    . . .
    ServerName  example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html

    <Directory /var/www/html>
        AllowOverride All
    </Directory>
    . . .
</VirtualHost>

Now restart your web server to execute the changes you have done in php and apache

$ sudo service apache2 restart

Now, if you have done till now without any issue then clone the desired version drupal repository to /var/www/html. Follow the given syntax –

git clone --branch 8.x http://git.drupal.org/project/drupal.git

Now, extract the file. Get into the drupal extracted folder ands do composer install.

$ composer install --no-dev

And search for the given address in your browser

http://localhost/"<name of the directory you cloned>"

Hope you gotcha. Just install with your valid database name, username & password.

drupal1

Advertisements

How to make a USB drive bootable (in Linux distros) ?

Greeting folks,

Things you need to make a bootable USB drive are –

  • a USB drive with minimum 2 GB space
  • a machine with any Linux machine

First, you need to download the desired ISO file.

Once your downloading work is finished, open Disks in your system and select your USB drive.

Now format your USB to fat 32 ( be careful while selecting and formatting your USB ).

Now open Startup disk creator in your machine, select your ISO file and click on Make Startup Disk button. It will take some time, wait till it finishes.

Finally, you are done with it.

Yeah, this method is very easy for beginners but what if someone wants to do through terminal ? Developers might feel to do everything using the terminal, right ?    😛

So developers, open  your terminal and do :

$ sudo apt-get install syslinux mtools

Create a mount point and mount Linux ISO image using the following command.

$ sudo mkdir /media/iso
$ sudo mount -o loop /opt/Ubuntu.iso /media/iso

Now connect your USB. In case it is not mounted the to mount it, do :

$ sudo mount /dev/sdc /medma/usb

Copy all files from mounted iso to the USB drive.

$ sudo cp -ra /media/iso/* /media/usb

Finally, we need to make this USB bootable. Copy ldlinux.sys file to USB drive to make it bootable.

$ sudo syslinux -s /dev/sdd1

Now rename some required files and directories as like below. Navigate to USB drive

$ cd /medma/usb
$ mv isolinux syslinux
$ cd syslinux
$ mv isolinux.cfg syslinux.cfg

Now you can connect this USB to the computer which you need to install Linux operating system and boot it from USB.

 

Fix : zsh corrupt error

Folks,

Recently I got an issue, whenever I open my terminal it shows some error that my .zsh got corrupt.

Somewhat like this :

$ zsh: corrupt history file /home/myusername/.zsh_history

How to fix this issue ?

This is due to some error in zsh history.

You just need to copy the following codes in your terminal :

$ cd ~

$ mv .zsh_history .zsh_history_bad

$ strings .zsh_history_bad > .zsh_history

$ fc -R .zsh_history

Now reboot your system

$ sudo reboot

                                                         Or

One of my senior suggested me that we don’t have to go so long, we can just simply delete our  ~/.zsh_history. To remove that just follow these codes –

echo $HISTFILE

And

rm $HISTFILE

 

Now that error won’t prompt you. #</HappycOding>

Creating a Drupal site

Hey Folks

Get your own Drupal site within few minutes and few clicks 🙂

First install xampp

Go to this link and download xampp according to your operating system -> http://www.apachefriends.org/en/xampp-linux.html\

Then follow these codes –

cd /home/[Username]/Downloads
ls

Now to make installable file execute

chmod +x xampp-linux-1.8.2-0-installer.run

Your file is ready to execute, now to run this file

sudo -s -H
./xampp-linux-1.8.2-0-installer.run

Now you will get a dialogue box to install it, do install

and then type the following command to get started with xampp

sudo /opt/lampp/lampp restart

Here you installed xampp server

Now go to your browser and type the following on address bar

http://localhost/

and you will be redirected to xampp server. Scroll down and check for Drupal in the following list. Click on Drupal to Download.

Now do the following commands

cd 
cd Downloads/
ls
chmod +x <name of the drupal file you downloaded>
./ <name of the drupal file you downloaded>

This will show you another dialogue box to install Drupal. install it and get into your own Drupal site 🙂

 

Hope this worked for you

Changing Ubuntu’s password

Hello folks, usually we should keep a perfect password for our computer which will safer, secure and easy to remember. But it happens sometimes that you forget your password. This blog will no more offend for forgetting ubuntu’s password. 🙂

 

Very first thing you need to do is **reboot your computer**

Hold shift key to get into GRUB, for dual booted version they automatically get into GRUB.

Highlight your image of Ubuntu and press E to edit image.

Find out the line starting with linux and at the end of the line Type this command -> rw init=/bin/bash

Then press F10 or ctrl + x to boot and wait for sometime, if it comes as a blank page with a blinking underscore then do all above steps again.

Hope it worked till now …….

Now you get into root mode and type passwd <your username>

You will get an option to enter a new UNIX password, enter your new password and press enter.

REBOOT YOUR SYSTEM 🙂

Congratulations your are back to ubuntu 🙂