Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install basic tools in Ubuntu 22.04 LTS. It includes: oh-my-zsh, idle, venv, git, tree, MySQL, PHP, phpMyAdmin.

Install Git in Ubuntu 18.04 LTS

  • Install Git:
    sudo apt install git
  • Add global configuration for Git user:
    git config --global ""
    git config --global "Your Name"
  • Add SSH. Details can be found in this gist


Install Oh My Zsh in Ubuntu 18.04 LTS

  • Install Zsh:
    sudo apt install zsh
  • Install git:
    sudo apt install git
  • Install oh-my-zsh:
    sh -c "$(wget -O -)"
  • Make zsh as default shell:
    chsh -s `which zsh`
  • Re-login to desktop to reflect changes.

Install PHP, MySQL, phpMyAdmin in Ubuntu 18.04 LTS

Install Mysql Server and MySQL Client

What is the difference between MySQL Server and MySQL Client?

MySql Client: The mysql-client package allows you to connect to a MySQL server. It will give you the mysql command-line program.

MySql Server: The mysql-server package allows to run a MySQL server which can host multiple databases and process queries on those databases.

  • Update Ubuntu

    sudo apt update
  • Upgrade Ubuntu

    sudo apt upgrade
  • Install MySQL Server

    sudo apt install mysql-server

    Enter root user password if asked.

  • Install MySQL Client

    sudo apt install mysql-client
  • Configure MySQL

    sudo mysql_secure_installation
    [sudo] password for USER_NAME_OF_MACHINE: 
    Would you like to setup VALIDATE PASSWORD plugin?
    Press y|Y for Yes, any other key for No: 
    Please set the password for root here.
    New password: 
    Re-enter new password: 
    Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
    Disallow root login remotely? (Press y|Y for Yes, any other key for No) : 
    ... skipping.
    Remove test database and access to it? (Press y|Y for Yes, any other key for No) :   
    ... skipping.
    Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
    All done!  
  • Test MySQL service

    systemctl status mysql.service
  • Test connecting to database

    sudo mysqladmin -p -u root version
  • Open Mysql Console

    sudo mysql -p -u root
  • In case the MySQL is not running, start it with

    sudo systemctl start mysql
  • In case you need to restart MySQL, restart it with

    sudo systemctl restart mysql
  • Create database in MySQL console

    create database cp_intrafish;
  • Install mysql-config

    sudo apt-get install libmysqlclient-dev
  • Load Database dump to the newly created database. Here cp_intrafish is the database name and myifm_dump.sql is the SQL dump file.

    mysql -p -u root cp_intrafish<myifm_dump.sql
  • Pretty output in MySQL console. Add \G at the end of your command. This will change the output just for that command, without changing the default output.

    SELECT * FROM product_price\G;

Install Apache2

sudo apt-get -y install apache2

Install PHP

sudo apt-get -y install php libapache2-mod-php
sudo apt-get -y install php-mbstring php-mbstring php-gettext
systemctl restart apache2
php --version

Install phpMyAdmin

sudo apt-get -y install phpmyadmin
sudo systemctl restart mysql.service

Edit Apache webserver config file

sudo nano /etc/apache2/apache2.conf
  • Add the following line at the end:
    Include /etc/phpmyadmin/apache.conf
  • Restart Apache server
    sudo systemctl restart apache2
  • To access phpMyAdmin go to http://localhost/phpmyadmin/

Handling Error in accessing database using phpMyAdmin

MySQL 5.7 changed the secure model: now MySQL root login requires a sudo.

I.e., phpMyAdmin will be not able to use root credentials.

The simplest, safest and permanent solution will be create a new user and grant required privileges.

  • Connect to MySQL
    sudo mysql --user=root mysql
  • Create an user for phpMyAdmin Replace some_pass by the desired password:
    CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'some_pass';
    If you get ERROR 1396 (HY000): Operation CREATE USER failed for 'phpmyadmin'@'localhost', check if you have already an user called phpmyadmin using:
    select user,host from user;
    Then give all privileges to the user:
    GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;

If your phpMyAdmin is connecting to localhost, this should be enough.

  • Add File read/write permission for current user in /var/www directory:
    ➜  ~ whoami
    ➜  ~ sudo adduser arsho www-data
    [sudo] password for arsho: 
    Adding user `arsho' to group `www-data' ...
    Adding user arsho to group www-data
    ➜  ~ sudo chown -R www-data:www-data /var/www
    ➜  ~ sudo chmod -R g+rwX /var/www
  • Logout and Login again.


Install Tools for Python

  • Ubuntu 18.04 comes with Python 3.6.7:
    python3 --version                
    Python 3.6.7
  • It does not have idle or venv in it.
  • Install idle:
    sudo apt install idle
  • Install venv:
    sudo apt-get install python3-venv

(Optional) Create Flask application inside virtual environment and run locally:

  • Create new virtual environment and activate it
    python3 -m venv venv             
    source venv/bin/activate
  • Install flask:
    pip install flask
  • Application
    from flask import Flask
    app = Flask(__name__)
    def index():
        return "Hello from Flask"
  • Environment file .flaskenv:
  • Run the application:
    flask run

Install tree package in Ubuntu 18.04

  • Install the package:
    sudo apt install tree
  • Show current directory in tree view:
  • Ignore a specific directory in tree view:
    tree -I venv
  • Ignore multiple directories or pattern in tree view:
    tree -I 'venv|__pycache__'

Steps to install Ubuntu 18.04 alongside pre installed Windows 10 as dual boot in NVMe SSD.

Hardware Information:

  • Dell G5 5587
  • Core i7 8750H
  • RAM 16 GB
  • NVMe SSD (Toshiba) 256 GB
  • HDD 1 TB
  • NVIDIA® GeForce® GTX 1060 6GB GDDR5 with Max-Q Design

Download Files

Check Target Machine (optional)

  • Press Win + R.
  • Type msinfo32 and press Enter.
  • Look for the BIOS Mode entry.
  • If the value listed is Legacy, then the Boot Environment is BIOS, otherwise the respective Boot Environment will be listed.

Burn the ISO to a Pendrive

  • Insert a USB pendrive.
  • Backup the pendrive data if necessary.
  • Open Rufus.
  • Select Partition Scheme MBR.
  • Keep the other settings to default. E.g.: FAT.
  • Select the ISO and burn it to the connected pendrive.

Create Unallocated Space for Ubuntu

  • Open disk management in Windows.
  • Shrink the volume where Windows is installed(NVMe SSD). The size depends on yourself. I have created 100 GB of unallocated space.

Turn off Fast startup from Windows 10

  • Dual boot does not work when Fast startup option is enabled in Windows 10.
  • Right-click the Start button.
  • Click Search.
  • Type Control Panel and hit Enter on your keyboard.
  • Click Power Options.
  • Click Choose what the power buttons do.
  • Click Change settings that are currently unavailable.
  • Uncheck Turn on fast startup (recommended).
  • Click Save changes.

Turn off secure boot from BIOS

  • Tap F2 key at the Dell logo screen to enter System Setup or BIOS.
  • On the left pane, click Boot Sequence.
  • Check that Secure Boot is set to Disabled. Within the BIOS go to Secure Boot > Secure Boot Enable, and set the checkbox to Disabled.
  • Change the Secure Boot Mode to audit mode.
  • Save settings and the machine will be restarted.

Enable AHCI for dual boot

  • With a preinstalled Windows SATA mode set to IDE or RAID in BIOS.
  • To install dual boot we need to change SATA mode to AHCI from BIOS.
  • Create the Windows 10 local account:
    • Go to Settings > Accounts.
    • Select Family & other users.
    • Tap Add someone else to this PC.
    • Select I don't have this person's sign-in information.
    • Select Add a user without a Microsoft account.
    • Enter a username, type the account's password twice, enter a clue and select Next.
    • Change the Account type of this newly created account to Administrator.
    • Login using this new user account.
  • Right-click the Windows Start Menu. Choose Command Prompt (Admin).
  • Type this command and press ENTER: bcdedit /set {current} safeboot minimal
  • Restart the computer and enter BIOS Setup. On Dell Inspiron it is F2.
  • Change the SATA Operation mode to AHCI from either IDE or RAID.
  • Save changes and exit Setup and Windows will automatically boot to Safe Mode.
  • Right-click the Windows Start Menu once more. Choose Command Prompt (Admin).
  • Type this command and press ENTER: bcdedit /deletevalue {current} safeboot
  • Reboot once more and Windows will automatically start with AHCI drivers enabled.

Install Ubuntu

  • After the OS burn, insert the pendrive and restart the machine.
  • Press F12 or F10 depending your machine.
  • Select USB/Removable media.
  • Select install Ubuntu.
  • Select Language and other options.
  • When it comes to partition option, select something else.
  • In the unallocated space:
    • Give 2 GB Logical space to swap memory. The swap size depends on your RAM size.
    • Give remaining Primary space to / partition
  • Select Windows Boot Manager as Device for boot loader installation.
  • Continue with the remaining process.

Install Drivers (optional)

  • After successful installation of Ubuntu, update the system softwares.
  • To update the drivers:
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    ubuntu-drivers devices
    sudo ubuntu-drivers autoinstall
  • You may now access both Windows and Ubuntu in a dual boot manner.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment