Install the LAMP Stack Using Tasksel on Ubuntu 16.04

Dịch vụ Hosting Vps giá rẻ

VPS Việt Nam giá rẻ, cấu hình mạnh, ổn định. Được đặt tại Datacenter FPT. Giá chỉ từ 50k cùng nhiều phần quà hấp dẫn Nâng cấp dễ dàng, không tốn thêm phí Cam kết hoàn tiền ngay nếu không hài lòng . Đăng Ký : vps giá rẻ Ngay.
Follow Me

There are multiple ways of installing software on Debian based systems like Ubuntu and Mint. Tools like apt, apt-get, aptitude and/or synaptic are usually used to install single applications into the desktop editions of those OS. Alternatively, Tasksel is a command line app for installing a “group” of related packages onto a server. Tasksel is not installed by default on the desktop editions of the ‘nix’ versions that contain the above-mentioned package managers but, it is installed on later versions of Debian and Ubuntu server editions.

How Does Tasksel Work?

Tasksel uses meta-packages to pull a ‘virtual group’ of software apps and dependencies together to install a software bundle defined by a configuration (or .cfg) file. Metapackages themselves do not contain the actual applications, they simply reference a group of packages together as seen here. In this case, this is a reference to a software install for ubuntu-server.

If one or more of the underlying dependencies in the metapackage is removed, all of the other packages that were in the metapackages dependencies list will still be installed on the system.

Let’s Begin!

Initially, we want to make sure our Ubuntu server is up to date with the latest software:

[email protected]:~# apt-get update
Get:1 xenial-security InRelease [107 kB] Hit:2 xenial InRelease
Get:3 xenial-updates InRelease [109 kB] Get:4 xenial-backports InRelease [107 kB] Fetched 323 kB in 0s (1,019 kB/s)
Reading package lists... Done

Is Tasksel Already Installed?

To verify if Tasksel is already installed, run:

[email protected]:~# which tasksel

Install Tasksel

If Tasksel is not installed, install it from the command-line:

[email protected]:~# apt-get install tasksel

Error Running Tasksel?

After installing, if by chance you get an error similar to:

[email protected]:~# tasksel
tasksel: apt-get failed (100)
Simply run:

[email protected]:~# dpkg --configure -aThat should correct that error message.

What Can I Install With Tasksel?

To see a list of all the packages available to install, use the  “–list-tasks” flag with the Tasksel command:

[email protected]:~# tasksel --list-tasks
u manual    Manual package selection
u kubuntu-live    Kubuntu live CD
u lubuntu-live    Lubuntu live CD
u ubuntu-gnome-live    Ubuntu GNOME live CD
u ubuntu-live    Ubuntu live CD
u ubuntu-mate-live    Ubuntu MATE Live CD
u ubuntustudio-dvd-live    Ubuntu Studio live DVD
u ubuntustudio-live    Ubuntu Studio live CD
u xubuntu-live    Xubuntu live CD
u cloud-image    Ubuntu Cloud Image (instance)
u dns-server    DNS server
u edubuntu-desktop-gnome    Edubuntu desktop
u kubuntu-desktop    Kubuntu desktop
u kubuntu-full    Kubuntu full
u lamp-server    LAMP server
u lubuntu-core    Lubuntu minimal installation
u lubuntu-desktop    Lubuntu Desktop
u mail-server    Mail server
u mythbuntu-backend-master    Mythbuntu master backend
u mythbuntu-backend-slave    Mythbuntu slave backend
u mythbuntu-desktop    Mythbuntu additional roles
u mythbuntu-frontend    Mythbuntu frontend
u postgresql-server    PostgreSQL database
u samba-server    Samba file server
u tomcat-server    Tomcat Java server
u ubuntu-desktop    Ubuntu desktop
u ubuntu-gnome-desktop    Ubuntu GNOME desktop
u ubuntu-mate-cloudtop    Ubuntu MATE cloudtop
u ubuntu-mate-core    Ubuntu MATE minimal installation
u ubuntu-mate-desktop    Ubuntu MATE desktop
u ubuntu-usb    Ubuntu desktop USB
u ubuntustudio-audio    Audio recording and editing suite
u ubuntustudio-desktop    Ubuntu Studio desktop
u ubuntustudio-desktop-core    Ubuntu Studio minimal DE installation
u ubuntustudio-font-meta    Large selection of font packages
u ubuntustudio-graphics    2D/3D creation and editing suite
u ubuntustudio-photography    Photograph touchup and editing suite
u ubuntustudio-publishing    Publishing applications
u ubuntustudio-video    Video creation and editing suite
u virt-host    Virtual Machine host
u xubuntu-core    Xubuntu minimal installation
u xubuntu-desktop    Xubuntu desktop
i openssh-server    OpenSSH server
i server    Basic Ubuntu server

Now, let’s move on to installing the LAMP stack!


What Is The LAMP Stack?

The LAMP stack is the basis for running one of the most stable and time-tested server platforms for hosting websites. LAMP is an acronym for the Linux, Apache, MySQL and PHP software stack.

  • Linux: The operating system
  • Apache: The web server software
  • MySQL: The database server software
  • PHP: The programming language the sites are coded in

Instead of having to install all of those software packages separately, Tasksel offers a handy way to get a LAMP stack up and running very quickly.


How Do I Install A LAMP Server Using Tasksel?

To install a LAMP server, SSH into your new Ubuntu 16.04 server and open the terminal. At the terminals prompt, enter the following command:

[email protected]:~# tasksel

If you make an error or accidentally select the wrong software package, simply hit the “escape” key and restart the process!

This will open up the Software Selection menu where you can choose the software group you would like to install. In this case, we’re going to install LAMP.

Simply scroll down the menu using your keyboards arrow keys until you see the LAMP server option:

Select this group by hitting the spacebar on your keyboard. Next, hit the ‘tab’ key and click the “<OK>” button.

Next, Tasksel will begin installing the server’s software.

At a midpoint during the install, you will be asked to supply a MySQL password, twice. (Make sure you use a secure password!!!)

Add the same password again. Next, click the ‘ok’ button to continue the install.

After that, the install will continue to run…

That’s really all you need to do when installing LAMP this way!


All Finished?

When the install reaches 100%, it will drop you back to the bash prompt. You can verify that Tasksel installed the LAMP stack successfully by running the following command:

[email protected]:~# tasksel --list-tasks |grep "lamp-server"
i lamp-server    LAMP server


Verify Apache is Installed

To verify that Apache was installed, simply open a browser window and type in the IP address of the server (Example: ). You should see a page similar to this:

Verify PHP is Installed

To get further details about the install, let’s create a phpinfo.php page.

[email protected]:~# touch /var/www/html/phpinfo.php

Now, open the file using the “vi” command.

[email protected]:~# vi /var/www/html/phpinfo.php

Next, add this small snippet of code to the phpinfo.php file. Click the ‘insert’ button to edit the file then paste it into the file.

// Show all information. This page defaults to INFO_ALL
Once the code has been added to the file, save the file using the “:wq” command.

Now, open your browser and type in the IP address of the server, followed by the phpinfo.php page like so:

You should see a PHP page similar to the following:

Install Other Services With Ease

If needed, you can install other multiple services like Tomcat, mail server, OpenSSH or a DNS server by using these Tasksel commands:

[email protected]:~# tasksel install tomcat

[email protected]:~# tasksel install mail-server

[email protected]:~# tasksel install dns-server

[email protected]:~# tasksel install openssh-server

In conclusion, Tasksel is an easy-to-use group package installer with a pleasing interface to assist users in installing multiple programs on their Debian or Ubuntu based Linux servers.

How can we help?

Thanks for taking the time to read up on the benefits of using Tasksel. Our Support Team is full of talented System Admins who have an intimate knowledge of web hosting technologies like those discussed in this article. If you are unsure about any of the steps outlined above, we are just a phone call, chat or ticket away from providing further information. Let us know what you think!