Ubuntu 22.04 Server Installation with LAMP Stack Setup
Canonical, the company behind Ubuntu, released Ubuntu 22.04 LTS (Jammy Jellyfish) on April 21, 2022, for Ubuntu Desktop, Ubuntu Server, Ubuntu Cloud, and Ubuntu Core with a five years long term support guaranteed on software and updates until April 2032.
The scope of this tutorial is to present a classic installation of Ubuntu 22.04 Server made from a CD media or a USB bootable stick and also, a basic installation of LAMP (Linux, Apache, MySQL, and PHP) packages stack with basic configurations.
Download Ubuntu 22.04 Server
The installation of Ubuntu 22.04 ISO image can be downloaded using the following link for 64-bit bit systems only.
Step 1: Installing Ubuntu 22.04 Server
1. Create a bootable CD/USB image using some bootable creators. After the system booting sequence choose your media bootable type from BIOS options (CD/DVD or USB Drive).
On the first prompt choose Install Ubuntu Server end and hit Enter.
2. Next select your System default Language and also Installation Process Language.
3. Please choose your keyboard layout or select “Identify keyboard” to detect your layout automatically.
4. Choose the first option ‘Ubuntu Server‘ for your installation.
5. On the next prompt series enter your network interface settings: IP address, netmask, gateway, and DNS name servers.
If your server is connected to the network, and you run a DHCP server on your directly connected network the installer automatically configures network settings with the ones provided by the DHCP server.
6. If you don’t access the Internet through a proxy leave it blank and Continue.
7. If you don’t have other Ubuntu mirrors, stick to default and Continue.
8. The hard-disks Partition table is one of the most sensitive subjects involving a server because here you have a lot of tweaking to do depending on your server’s final destination type web server, databases, file sharing NFS, Samba, application server, etc.
- For example, if redundancy, fail-over, and high availability are needed you can set up RAID 1, if your space grows fast you can set up RAID 0 and LVM, and so on.
- For more general use you can just use the Guided option with LVM, which is a customized option made by developers.
- For a production environment, you probably should have LVM, software, or hardware RAID and separate partitions for /(root), /home, /boot, and /var ( the /var partition has the fastest growth rate on a production server because here are logs, databases, applications meta info, servers caches and others located.
So, now on guided storage configuration, choose “Use an entire disk” and set up the disk as an LVM group as shown.
9. Confirm the partition table, If you like to make some changes to this Partition Table you can select ‘Back‘ and edit your partitions.
10. Confirm the write changes to the disk.
11. Now is the time to set up your administrative user. On Ubuntu, this user replaces the root account and has all root account powers by employing sudo. Enter your username and hit on Continue.
12. Ubuntu Pro is a yearly subscription that offers open-source software security updates, which you can use free of charge for personal use on up to 5 machines. For enterprise, you need to purchase a subscription. I am skipping this option for now.
13. Next, install OpenSSH Server to enable remote login.
14. The “Featured Server Snaps” window shows popular snaps in your server environment. If you don’t want to install any snaps, just leave them blank and continue to Ubuntu installation.
15. Once installation and updates are finished, remove your media installation drive (CD/DVD, or USB) and hit Reboot Now/strong> to reboot.
Congratulations! Ubuntu 22.04 LTS Server edition is now installed and ready to rock on your brand-new metal or virtual machine.
Step 2: Basic Network Configurations
For now, only the Core server packages are installed and you can’t really offer network services for your network.
16. In order to install software login to your server console for now and verify some basic configurations like network connectivity, settings, startup daemons, software sources, updates, and others by running a series of Linux commands.
17. View system load and basic information – After login with your credentials this information is presented by default MOTD. Also, top and htop commands are useful.
18. Verify network IP addresses using the following ip command.
$ ip addr
19. Verify internet connectivity: run a ping command against a domain name (this will test TCP/IP stack and DNS).
$ ping –c 4 google.com
If you get the “Temporary failure in name resolution“ message, edit your ‘/etc/resolv.conf’ file and add the following.
20. Verify the machine hostname using the following command.
$ cat /etc/hostname $ cat /etc/hosts $ hostname $ hostname –f
21. Finally, update and upgrade your Ubuntu system.
$ sudo apt-get update $ sudo apt-get upgrade
Step 3: Install LAMP Stack in Ubuntu 22.04
LAMP acronym stands for Linux OS, Apache HTTP Server, MySQL, MariaDB, MongoDB databases, Php, Perl, or Python programming languages used for generating dynamic webpages.
All of these components are free and Open-Source software and are suitable for building dynamic websites or other web applications and are the most used platforms on the Internet today (Last year Apache was estimated to serve over 23.04% of all active websites).
22. LAMP stack can be installed step by step or using just one single command.
$ sudo apt install apache2 php php-mysql mysql-client mysql-server
23. To confirm php status create an ‘info.php‘ file in the ‘/var/www/html’ server path with the following content.
$ sudo echo "" > /var/www/html/info.php
24. Then open a browser and enter your server IP address or http://server_address/info.php.
Ubuntu 22.04 and LAMP is an excellent platform to deliver network services and develop all kinds of dynamic or static websites, and complex web applications with the help of Apache, all of this made with a minimum financial impact using Free and Open Source software and the latest technologies.