How to install a LAMP environment in a Ubuntu Server 13.04 in one line

Andy, Apache WarriorAnd in this case with the ‘P’ I am referring to PHP and not to Perl.

There are a lot of options (this is Linux), first one is using the tasksel tool.

For example, you can use tasksel to see the list of available tasks to install.

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

As you can see there are two of them already installed: Basic Ubuntu server and OpenSSH server. And a lot more that you can install in a single line.

For example to install a complete LAMP server you could execute the following command

jtome@ubuntu:~$ sudo tasksel install lamp-server
The following NEW packages will be installed:
  apache2 apache2-mpm-worker{a} apache2-utils{a} apache2.2-bin{a} apache2.2-common{a} 
  libaio1{a} libapr1{a} libaprutil1{a} libaprutil1-dbd-sqlite3{a} libaprutil1-ldap{a} 
  libdbd-mysql-perl{a} libdbi-perl{a} libhtml-template-perl{a} libmysqlclient18{a} 
  libnet-daemon-perl{a} libplrpc-perl{a} libterm-readkey-perl{a} mysql-client 
  mysql-client-5.5{a} mysql-client-core-5.5{a} mysql-common{a} mysql-server 
  mysql-server-5.5{a} mysql-server-core-5.5{a} php5-cli php5-common{a} php5-mysql ssl-cert{a} 
0 packages upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 33.2 MB of archives. After unpacking 111 MB will be used.
Do you want to continue? [Y/n/?]

This command installs a complete LAMP environment with PHP5 and Perl. Good, but not good enough for me. I don’t need Perl and I prefer not to install it.

Therefore I am going to use aptitude to install only the packages I need

jtome@ubuntu:~$ sudo aptitude install apache2 apache2-mpm-prefork mysql-client mysql-server php5-cli php5-mysql libapache2-mod-php5
The following NEW packages will be installed:
  apache2 apache2-mpm-prefork apache2-utils{a} apache2.2-bin{a} apache2.2-common{a} libaio1{a} 
  libapache2-mod-php5 libapr1{a} libaprutil1{a} libaprutil1-dbd-sqlite3{a} libaprutil1-ldap{a} 
  libdbd-mysql-perl{a} libdbi-perl{a} libmysqlclient18{a} libnet-daemon-perl{a} 
  libplrpc-perl{a} libterm-readkey-perl{a} mysql-client mysql-client-5.5{a} 
  mysql-client-core-5.5{a} mysql-common{a} mysql-server mysql-server-5.5{a} 
  mysql-server-core-5.5{a} php5-cli php5-common{a} php5-mysql ssl-cert{a} 
0 packages upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.8 MB of archives. After unpacking 119 MB will be used.
Do you want to continue? [Y/n/?]

After typing ‘y’ in order to continue and after waiting some seconds in order all the packages been downloaded and installed you will have a fully functional LAMP environment in order to work with it (the only question you will have to answer is the password for the root user of the MySQL server).

References

I have seen the info about the tasksel command in this blog post.

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *