How to build Linux web server with an old computer

If you are interested in building a home web server, the easiest way is to install Linux on the backup computer. Doing this is simple and gives you a logical way to host a website or blog.

If you are interested in building a home web server, the easiest way is to install Linux on the backup computer. Thanks to the simplicity of Linux, doing this is simple and gives you a reasonable way to host a website or blog. Here's how to set up a Linux web server.

Using an old computer to create Linux web server

  1. How to create your own web server with Linux
    1. 1. Find an old computer for the Linux web server
    2. 2. Install the Linux operating system
    3. 3. Install Linux web server software
    4. Check the web server!
  2. Find the server's local IP address
  3. Share web folder
  4. Help Linux server online with Port forwarding
  5. Give Linux web server a static hostname

How to create your own web server with Linux

To build a Linux web server that can be run from home, you will need the hardware and the operating system. In addition, web server software and server access facilities from the Internet should be installed.

The article will be divided into 4 simple steps that you can follow to build your own Linux web server.

1. Find an old computer that is no longer in use

2. Install the Linux operating system

3. Set up application web server software (Apache, PHP, MySQL)

4. Access the server from the Internet

Let's get It Started!

1. Find an old computer for the Linux web server

Before choosing a computer to use as a web server, you will need to know the minimum operating system requirements. Although Ubuntu is popular, it is not lightweight enough. Instead, Lubuntu 19.04 is a stronger option. This is a lighter alternative to Ubuntu, built on the same code.

  1. Download Lubuntu 19.04.

Lubuntu system requirements

Lubuntu 19.04 has a minimum requirement of:

  1. Dual-core processor 512MHz or better (recommended is 1GHz, as opposed to 2GHz for Ubuntu)
  2. 4GB system memory
  3. 25GB of free hard drive space
  4. Select 32-bit version (for old PC) and 64-bit version

You can have a suitable old PC somewhere in the house or buy a used one at a second hand store. It is worth noting that you can install Linux web server on the Raspberry Pi. This small computer costs less than $ 30 (690,000 VND) and is a smart choice if you have trouble with old hardware.

Also, don't limit it to older Windows PCs. Apple Macs and MacBooks from before 2006 with PowerPC processors can also run Linux.

Like Ubuntu, Lubuntu supports many types of video cards, hard drives and other hardware. To check if the distribution works on the hardware you have selected, run the Live CD.

If you plan to run the server 24/7, make sure it is in a well-ventilated area. It is better to place it in an air-conditioned room in the summer, when the temperature is an enemy to your server.

2. Install the Linux operating system

How to build Linux web server with an old computer Picture 1

Installing Lubuntu is very simple. Just grab the ISO file and burn it to DVD or USB to get started.

These disk images have the latest software versions, so only a minor upgrade is required after installation. Use a 64-bit version if supported by the computer or a 32-bit version otherwise.

When ready, insert the installation media into the computer and reboot. If you need to change the BIOS settings to boot from an optical drive or USB, do so. In some cases, a boot media selection menu may be opened.

For bootable installation media, choose Install Lubuntu. When prompted, select Download updates while installing and Install 3rd Party Software , then click Erase and Use the Entire Disk .

Note that this step will delete all other operating systems you have on this computer. Follow the other options for each desired setting. Encrypting the Home directory is not the smart thing for a web server project. Restart after installation is completed.

When rebooted, check for updates. Go to System> Administration> Update Manager> Install Updates . You may need to reboot after installing any updates.

3. Install Linux web server software

Although many alternatives are available, most websites run on a combination of Apache, MySQL and PHP (called LAMP). This is similar to what you should install on Windows.

All three tools can be installed via the Software Center. Launch this application via System> Administration> Synaptic Package Manager . This is where you install the software you need.

Search and install the following packages, each name will include different prerequisites: apache2, php5, php5-mysql and mysql-serve r. Apply changes to install packages.

Packages will download and install shortly. The installer will prompt you to enter the MySQL 'root' password. No need to reboot.

You can replace installing these tools in the command line. Open Terminal then type:

 sudo apt install lamp-server^ -y 

How to build Linux web server with an old computer Picture 2

Check the web server!

You can check the settings by opening the Firefox browser on your server and visiting the URL http://127.0.0.1/. Alternatively, enter http:/// localhost /.

You should see the message 'Itworks!' . That means your web server is running!

Both Apache and MySQL will run in the background and start booting. With the web server currently running, you can edit the files in / var / www. Just refresh the browser to see the changes live on the web.

Find the server's local IP address

While the server is active, it should be visible to the outside world. Therefore, it is important to keep the server updated with all the usual patches.

First, find the server's local IP address and set it to something you will be able to refer to later. You will find the current IP address, specified by the router in the Network Information box .

Find this information by clicking on the network connection, then select Connection Information. This will bring up a box with the current IP address, network adapter card, Broadcast address, port and DNS server. Please record the IP address.

Next, edit the connection information to provide a static IP address on the local network. Right-click again, but this time go to Edit Connections. Select the appropriate adapter name (for example, eth1) and edit the settings.

Select the IPv4 tab and switch Method to Manual. Click Add then enter information from connection settings. However, note the IP address will need to be entered differently. Retains the first 3 octets (numbers between dots) but changes the last number to a higher number (below 254).

It is important that manually assigned IP addresses are not used on your network. If unsure, choose a high IP address like 250. This will be your local, static IP address.

Share web folder

Several options are available to access and upload files to the server. To illustrate the importance of directory permissions, consider sharing web directories as options.

It is important to use this method only if your server is on a private network. Make sure no one can connect to it and access your shared folder.

Start by processing the permissions on the web directory. Open a terminal by pressing Ctrl + Alt + T , then type:

 sudo chmod 777 /var/www 

You will be prompted for a password. If true, the rights will be updated.

Now go to the file browser and find / var /. Right-click on the www folder and then select Sharing options and uncheck it. For security options, you can share it with or without a password. Select Guest access to share the folder without requiring a username and password.

Now, you or anyone else will be able to access the files without a password. For this reason, sharing with passwords is recommended for security purposes. Also take a moment to check Allow others to create and delete files in this folder . This option gives you write access from the shared folder.

To view your file, visit the network location // localhost / www .

How to build Linux web server with an old computer Picture 3

It will prompt for a password or allow you to access your files directly, depending on your security settings. These are the same files that can be accessed in the web browser via http:/// localhost / (or whatever static IP address you set).

Help Linux server online with Port forwarding

Now that you have an IP address, another important concept to understand is port forwarding. Each person is connected to the Internet via an IP address. For most home connections (and many corporate connections), the computer's IP is not really exposed to the Internet.

So how do site visitors contact the server? This can be done with Port forwarding.

The gateway on the server is like the door of a house and has a security meaning. Each port will give you access to a different service running on the server. Web servers use port 80 by default.

To enable this feature, you will need to log into the router's administration page. Check the device's documentation for details on this (some routers have an IP address printed on the back). Here, you should find a section called Port Forwarding or Applications that allows you to forward ports properly.

Forward TCP port 80 into the network, to the static IP address you set earlier. Each router will be different, so refer to the router's manual for proper setup.

Give Linux web server a static hostname

Most home routers connect to an ISP via what is called dynamic IP. This means that the public IP address for the router will change after a set amount of time, usually a week or so.

Alternatively, the DynDNS server allows you to set the DynDNS URL for your website. Thanks to the client, whenever the public IP address changes, the URL will still point to the Linux server.

Therefore, visitors will be able to access your web server from outside by going to http://yourhostname.dyndns.org. Some ISPs will block port 80 to the router. In this case, forward something like port 8080 to port 80. This will allow you to access your website by going to http://yourhostname.dyndns.org:8080.

Now that your web server is set up, you can focus on programming or installing your own software!

Perhaps you will run the blog software or host a forum or bulletin board (where people share information). You might be more interested in hosting a social network like Mastodon, a portfolio, or whatever you want.

Hope you are succesful.

« PREV POST
NEXT POST »