Skip to main content

Getting Started with Ubuntu

Getting Started with Ubuntu - KickOff for Beginners

This page aims to help beginners get familiar with Ubuntu, a popular Linux distribution actively supported by Canonical. Let's go!

Ubuntu OS - Cover Image


Ubuntu a short story

Ubuntu is a popular Linux-based operating system that was first released in 2004. It was developed by Canonical Ltd. and is based on the Debian Linux distribution, with the aim of providing an easy-to-use and user-friendly alternative to proprietary operating systems such as Microsoft Windows.

Ubuntu uses a package management system called apt (Advanced Package Tool) that allows users to easily install, remove, and update software packages on their system. Today, Ubuntu is one of the most popular Linux distributions in the world, used by millions of people across a wide range of devices, from desktop computers to servers and even smartphones.


Ubuntu How to install

There are two main ways to install Ubuntu: on a laptop/desktop and in a virtual machine.


👉 Installing Ubuntu on a Laptop/Desktop

Before we begin, here's what you'll need:

  • A laptop or PC with at least 25GB of storage space.
  • A 4GB or larger USB stick/flash drive.
  • An Ubuntu ISO file. You can download it from the official Ubuntu website.

✅ Create a bootable USB stick

To install Ubuntu on your computer, you need to create a bootable USB drive with the Ubuntu ISO file. Here's how you can do it on Windows:

  1. Download the Ubuntu ISO file from the official website.
  2. Download and install Rufus. It's a free and open source USB stick writing tool that you can use to create a bootable USB drive.
  3. Insert a USB drive with at least 4GB of space into your computer.
  4. Open Rufus and select the USB drive you inserted.
  5. Select the Ubuntu ISO file you downloaded.
  6. Keep the rest as default and click "START".
  7. Rufus may ask for additional files to complete writing the ISO. If this happens, select Yes to continue.
  8. You'll be alerted that Rufus has detected that the Ubuntu ISO is an ISOHybrid image. Keep Write in ISO Image mode selected and click OK to continue.
  9. Rufus will warn you that all data on your selected USB device will be destroyed. Double check that you've selected the correct device and click OK when you're sure.
  10. Wait a few minutes for Rufus to write the ISO to your USB stick.

If you are using a different operating system, you can use an alternative tool like Etcher to create the bootable USB drive.

✅ Install Ubuntu

  1. Restart your computer and enter the BIOS by pressing F2 or F10 or F12 (depending on your computer) when the logo appears.
  2. Go to the "Boot" tab and select the bootable USB drive as the primary boot option. Save and exit the BIOS. Your computer will restart and boot into the Ubuntu installation process.
  3. Follow the on-screen instructions to install Ubuntu on your computer.
  4. In the "Type of Installation" page, select "Erase disk and install Ubuntu" if you want Ubuntu to be the only operating system on your hard drive.
  5. Review your configuration then click "Install" when you are sure. Note that once you begin the installation process, you cannot return to this point.
  6. Once the process finishes, you will be asked to restart the system. Remove the USB disk and press enter. Your system will reboot and start Ubuntu.

You've successfully installed Ubuntu on your laptop or desktop computer. Enjoy exploring this powerful and user-friendly operating system!


👉 Installing Ubuntu in VirtualBox

If you don't want to install Ubuntu directly on your computer, you can also install it in a virtual machine using VirtualBox. Here's how to do it:

  1. Download and install VirtualBox from the official website.
  2. Download the Ubuntu ISO file from the official Ubuntu website.
  3. Open VirtualBox and click "New" to create a new virtual machine.
  4. Follow the on-screen instructions to create a new virtual machine. Fill in the appropriate details.
  5. Fill the basic details of your virtual machine.
    • Name: Ubuntu 22.04 (depends on your version)
    • Folder: Select folder where your virtual machines will be stored
    • ISO Image: Ubuntu ISO file you downloaded
    • Type: Linux
    • Version: Ubuntu (64-bit)
  6. Create a user profile with a username and password for the automatic installation.
  7. Specify the resources for your virtual machine, such as RAM and CPU usage, and the size of the hard disk.
    • Base memory: At least 4GB
    • Processors: 4 CPUs
    • Hard disk: Create a new virtual hard disk
    • Disk size: At least 25 GB
  8. Review the summary of your machine settings and click "Finish" to create the virtual machine.
  9. Start the virtual machine and follow the on-screen instructions to complete the Ubuntu installation.

Managing Ubuntu using the CLI

The command-line interface (CLI) is a powerful tool for managing Ubuntu. It allows you to perform various tasks quickly and efficiently Here are some basic commands you need to know:


👉 sudo

The sudo command allows you to execute a command with administrative privileges. sudo stands for "superuser do".
To use sudo, simply type sudo followed by the command you want to execute. For example, let's say you want to edit a file system, you need to use sudo to run it.

sudo nano /etc/config

When you run this command, Ubuntu will prompt you to enter your password. This is a security measure to prevent unauthorized access to administrative functions.


👉 apt

apt is the package manager for Ubuntu. It allows you to install, update, and remove packages from your system. Here are some basic apt commands:

  • update: updates the package list on your system.
  • upgrade: upgrades all the installed packages on your system.
  • install <packages>: installs a package.
  • remove <package>: removes a package.
  • purge <package>: removes a package and its configuration files.
  • autoremove: removes any unused packages from your system
  • autoclean: removes any downloaded package files that are no longer needed.

👉 apt-get

You might notice some people use apt-get instead of apt. Both command are used for managing software packages on Ubuntu systems. apt is actually a newer and more user-friendly version of apt-get. However, both commands are still available and you can use whichever one you prefer.


Managing the users via CLI

With the command-line tools available in Ubuntu, you can easily add and remove users, modify user settings, and perform other tasks related to user management.

Here are some basic commands for managing users via the CLI in Ubuntu:


👉 Adding a new user

To add a new user to your Ubuntu system, use the following command:

sudo adduser <username>

Replace <username> with the desired username. You will then be prompted to set a password and enter some basic information about the user.


👉 Removing a user

To remove a user from your Ubuntu system, use the following command:

sudo deluser <username>

Replace <username> with the username of the user you want to remove. After running this command, the user's home directory and any files or directories associated with their account will be removed from your system.


👉 Changing user passwords

To change the password for an existing user account, use the following command:

sudo passwd <username>

Replace <username> with the username of the user. After running this command, you will be prompted to enter a new password for the user.


Update Ubuntu for Programming

In Ubuntu, you can install packages easily using the package manager through CLI. To install a package on your Ubuntu system, use the following command:

sudo apt install <package-name>

Replace <package-name> with the name of the package you want to install.

Here are some recommended package to be installed:


👉 Install Python3

Python is a simple and versatile open-source programming language used for web development, data analysis, artificial intelligence, and more. It has an easy-to-learn syntax and a large library of pre-built modules, making it an excellent choice for beginners and professionals. You can install Python by running this command.

sudo apt update
sudo apt install python3 python3-pip

Then, verify the installation with the following command.

python3 --version
pip --version

👉 How to Install MySQL

MySQL is a popular relational database management system (RDBMS) used to store, manage and retrieve data. It is an open-source software that is widely used in web applications, and can be accessed through a variety of programming languages. To install and configure MySQL, follow these steps:

Install the MySQL server package.

sudo apt install mysql-server

Start the service

Once the installation is complete, MySQL will be automatically running. Otherwise, use the following command to start the service.

sudo systemctl start mysql

MySQL will be running on port 3306. This is MySQL's default port number.

Configure the database and user

  • Login to MySQL

    sudo mysql
  • Create database

CREATE DATABASE appseed_db;

Replace appseed_db with the name that you want.

  • Create user and grant permission to the user.

MySQL creates root user by default, but it's better to use another user for non-administrative functions. For this demo, we'll grant all permissions to all tables for the created user.

CREATE USER 'appseed_db_usr'@'localhost' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON appseed_db.* TO 'appseed_db_usr'@'localhost';
FLUSH PRIVILEGES;

Replace appseed_db with your database name, appseed_db_usr and pass with your desired username and password.

  • Exit MySQL
exit

👉 How to Install PostgreSQL

PostgreSQL is a powerful open-source object-relational database management system (ORDBMS) that offers robustness, scalability, and a wide range of advanced features. Its reliability and ability to handle large amounts of data make it a popular choice for enterprise-level applications. To install and configure PostgreSQL, follow these steps:

Install the PostgreSQL server package.

sudo apt install postgresql

Start the service

Once the installation is complete, PostgreSQL will be automatically running. Otherwise, use the following command to start the service.

sudo systemctl start postgresql

PortgreSQL will be running on port 5432. This is PortgreSQL's default port number.

Configure the database and user

  • Login to PostgreSQL
sudo -u postgres psql
  • Create database
CREATE DATABASE appseed_db;

Replace appseed_db with the name that you want.

  • Create a user and grant permission to the user.

For this demo, we'll grant all permissions to all tables for the created user.

CREATE USER appseed_db_usr WITH PASSWORD 'pass';
GRANT ALL PRIVILEGES ON DATABASE appseed_db TO appseed_db_usr;

Replace appseed_db with your database name, appseed_db_usr and pass with your desired username and password.

  • Exit PostgreSQL
\q

👉 How to Install MongoDB

MongoDB is a popular open-source NoSQL document-oriented database that stores data in flexible, JSON-like documents. It is designed for scalability and performance, making it ideal for handling big data and high-traffic applications. To install Mongo, follow these steps:

Install mongo

sudo apt install mongodb

Start the service

sudo systemctl start mongod

MongoDB will be running on port 27017. This is MongoDB's default port number.

Connect to MongoDB

mongo

This command will start the mongo client and connect to the local MongoDB instance.


👉 How to Install Redis

Redis is an open-source in-memory data structure store that can be used as a database, cache, and message broker. It offers fast read and write speeds, high availability, and support for multiple data structures. Redis is ideal for real-time data processing and caching, with a reliable and active developer community. To install Redis, follow these steps:

Install Redis server

sudo apt install redis-server

Start the service

After installing Redis, you need to start the Redis service to begin using it. To start the Redis service, run the following command:

sudo systemctl start redis

Connect to Redis

redis-cli

This will connect to the local Redis instance.


Managing the services

Services are background processes that perform various tasks, They are used to manage various system functions and can be controlled using the systemctl command.

  • start <service-name>: to start a service
  • stop <service-name>: to stop a service
  • restart <service-name>: to restart a service
  • enable <service-name>: to enable a service to start automatically at boot
  • disable <service-name>: to disable a service from start automatically at boot
  • status <service-name>: to check status of a service

For example, if you want to stop MySQL, you can run this command:

sudo systemctl stop mysql

CRON

CRON is a time-based job scheduling system used in Unix-like operating systems. It allows users to schedule repetitive tasks, such as running scripts or performing backups, at specific times or intervals.


👉 Creating CRON job

To create a new CRON job, follow these steps:

Open your terminal and type the following command.

crontab -e

This command will open the CRON configuration file. If this is your first time using CRON, you'll be prompted to choose your default text editor. Choose your preferred editor and press Enter.

Once the editor opens, add a new line at the bottom of the file with the following syntax:

* * * * * command-to-be-executed

This line represents your CRON job. The first five asterisks is a crontab that represents the time and date parameters for the job.

  • Minute (0-59)
  • Hour (0-23)
  • Day of the month (1-31)
  • Month (1-12)
  • Day of the week (0-6, where Sunday is 0)

You can use tools like crontab.guru to help you creating a crontab. For example, to schedule a job to run at 0:00 AM every day, use the following crontab.

0 0 * * * command-to-be-executed

Once you've added your CRON job, save and exit the editor.


👉 Viewing CRON jobs

To view your current CRON jobs, Open your terminal and type the following command:

crontab -l

This will display a list of all your current CRON jobs in the terminal window.


👉 Removing CRON jobs

To remove a CRON job, follow these steps:

  • ✅ Open your terminal and type the following command to open the CRON configuration file:
crontab -e
  • ✅ Once the editor opens, locate the line that corresponds to the job you want to remove and delete it.
  • ✅ Save and exit the editor.

✅ Resources