Setting up Ubuntu as a server - a guide
With the help of the terminal you can set up a web server quite easily under Ubuntu. You can use this server, for example, in the home network or as a laboratory for self-programmed websites. In this guide, we'll show you how to install and manage Apache, PHP5, and MySQL. You can find simple instructions in the picture gallery.
Web server on Ubuntu: install the missing packages
The necessary packages can best be installed with the package manager "apt" in the terminal.
- Open a terminal in Ubuntu. You can do this, for example, via the dash start page in the top left of the toolbar. Just search for "Terminal" there. You should be logged in as a user with admin rights.
- Now install the packages you need for a web server. Type: "sudo apt-get install apache2 php5 php5-mysql mysql-server libnet-ssleay-perl libauten-pam-perl libio-pty-perl apt-show-versions" without quotes. Confirm the "sudo" command with your password.
- Now Ubuntu installs the named packages. In between, the mySQL installation asks for a password for the server. Assign one for security, even if the server may only be operated in the home network.
- You can install a graphical user interface such as Webmin to manage your web server. Go to Webmin in the browser and download the Debian installer. (Alternatively, Froxlor or ISPConfig are also possible.)
- When the download is complete, navigate in your terminal to the folder in which the downloaded Webmin package is located. Install it with "sudo dpkg -i webmin [...]. Deb", replacing "webmin [...]. Deb" with the name of the package you downloaded.
- Now you're almost done. Test whether the installed services are working. Go to "// localhost: 10000" for Webmin and "// localhost" for the Apache server in the browser. The Apache server reports "It works!" When the installation is successful. On Webmin you can log in with your Ubuntu account.
- In order to put PHP and HTML pages on your server, you must have the necessary rights for the folder "/ var / www". So go back to the terminal and navigate to the "/ var" folder. There you set the read and write rights with "chmod": "sudo chmod 777 www".
- You can now store any HTML and PHP pages under "/ var / www" and manage your server under "// localhost: 10000".
In another practical tip you can read how to add a user on Ubuntu.