blog posts

Step-By-Step Guide To Building A Linux Server How To Implement A Linux Web Server?

Linux is one of the most flexible operating systems in the software world. The flexibility of this operating system is so great that it can be installed on an old computer and used without any problems. 

If you have an old desktop or laptop computer, you have the ability to create a web server using Linux and your old computer and use it to host different web platforms.

In other words, you have the opportunity to turn your old computer into a money-making tool. Are you interested in building a Linux home web server?

The easiest way to do this is to install Linux on a relatively old computer, as the Linux server does not require powerful hardware. So the above solution is a cost-effective way to host a website or blog.

How to create a web server with Linux?

To be able to access and benefit from a home web server, you must first have the requirements. To build a Linux home server, you must first prepare the hardware and software requirements as follows:

  1. Preparing an old computer that you no longer use.
  2.  Download the distribution suitable for installation on an old computer
  3. Install one of the webserver software such as Apache
  4. An Internet connection to access the server over the Internet

The first step is to prepare the computer

The computer you intend to use for this purpose must have at least the necessary specifications to install Linux. It is recommended to use two versions of Ubuntu and Lubuntu to build a home server.

While Ubuntu is a more popular distribution, we recommend using Lubuntu because Lubuntu 19.04 runs more smoothly than Ubuntu and uses the same source code.

The minimum hardware requirements required to install Lubunto are as follows:
  •  512MHz dual-core processor (Of course, it is recommended to use a 1GHz processor for Lubuntu and a 2GHz processor if you plan to use Ubuntu).
  •  4 GB of main memory
  •  25 GB of external memory
  •  32-bit or 64-bit distribution

As you can see, you do not need powerful hardware to run Linux, and you can install Linux on an older computer without any problems.

Additionally, if you have an older MacBook with a PowerPC processor, it is still possible to install these distributions on an older Mac computer.

Like Ubuntu, the Lubuntu version supports a wide range of graphics cards, hard drives, and other hardware.

Because the hardware requirements of professional servers are designed to be capable of long-term operation, but personal computers have different limitations in this regard, it is better to pay attention to the ambient temperature in which this computer is to be located, especially in hot seasons.

For example, personal computers use regular hard drives, while servers use hard drives designed for long-term work without shutting down the system.

The second step is to install the Linux distribution

As mentioned, Lubunto is a lighter and smoother version of Ubuntu, and because it is based on fast and smooth execution and minimal use of system resources, it works well on older hardware.

To download the image related to the above distribution, go to https://lubuntu.net/downloads/See. After downloading the image, burn it to a DVD or transfer it to flash memory.

If your computer’s CPU supports 64-bit architecture, we suggest you download the 64-bit version. To start the installation, start the computer after connecting the flash drive or inserting a DVD into the device. If nothing special happens after booting the system, it indicates that you need to edit the system boot settings.

 To do this, go to the system BIOS menu and select the boot option from flash memory so that the system can boot from flash memory or DVD.

After booting the computer and booting through the Linux image, first select the Install Lubuntu option, then the Download updates while installing option, the Install 3rd Party Software option, and finally the Erase and User the Entire Disk option.

Note that after selecting the Erase and Use the Entire Disk option, all current data and operating system will be removed from the system (of course, if the operating system is to be installed on a drive that already has the operating system installed on it).

After selecting the third option, select the other options according to the desired settings.

Note that encrypting the home folder in the server build process is not a fun task, as this computer is not to be used to serve other users. After installing Linux, boot the computer to complete the installation process.

After installation, go to System> Administration> Update Manager> Install Updates to receive new updates for the operating system. Though After installing the updates, boot the system to apply the changes.

Step 3, Install the software and server

There are many web server software, but most websites run on a combination of Apache, MySQL, and Patch software, known as LAMP. All three tools can be installed using System Center software.

After installing these tools, you need to go to System> Administration> Synaptic Package Manager to run them.

Typically, the above software is installed in the Synaptic Package Manager. After installing the above tools, we need to install other components and peripherals.

To do this, search for the names of other required packages, including apache2, php5, php5-MySQL, and MySQL-server, and install them.

After receiving the files, make the necessary changes to install them. When installing the software, the installer displays a message for the MySQL root password (the root account belongs to the user who has access to all the files and operating system commands).

It is also possible to install these files via the command line.

 To do this, open a Linux command line window and enter the following command:

sudo apt install lamp-server ^ -y

Executing the above command starts the installation process of the requirements we mentioned (Figure 1).

figure 1

Web server testing

Once the required requirements have been installed, the server must be tested in the next step. To test the webserver, just enter http://127.0.0.1 or HTTP: // localhost in the browser’s address bar.

If you see the message It works, it indicates that the server has no problem. If the webserver does not have a problem, both Apache and MySQL software will start running in the background of the operating system after the computer is turned on.

After running the server, you can go to / var/www to edit your files. You must update the URL entered in the browser to see the moment of the changes that take effect on the website.

Find the local IP address

. Indeed, the server works well, but it must be connected to the World Wide Web because it is very important to keep the server up to date by installing security patches.

First, find the local IP address of the server and set it to another IP address that can be referenced in the future. You can find the current IP address assigned by the router in the Network Information section.

To find the current IP address, after clicking on Network Connection and selecting Connection Information, view and record it.

In this section, in addition to the IP address, other information related to the network card, broadcast address, gateway, and server domain name system is also displayed.

 Next, you need to edit the Connection information to create a static IP address on the local network.

To do this, right-click and select Edit Connections.

Then select the network card (for example, eth1) and edit the following settings.

Select the IPv4 tab and change the Method option to Manual. Select the Add option and enter the network connection information. It is true that IP addresses in each system are different, but set the numeric value of the last part of the address to 254.

For example, if the address is 192.168.20.123, change it to 192.168.20.254. The new manual IP address you specify must be new and not used on the local network to create a static IP address.

Sharing web folders

There are several ways to upload files to the server and access them, however, the important thing to note is the importance of folder permissions and how to access them.

This mechanism should only be enabled when your server is on a personal network and you are sure that no user can connect to the network and access the shared folders. Editing permissions is done by first pressing Ctrl + Alt + T at the same time to open the terminal.

 After opening the terminal, enter the following command:

Sudo chmod 777 / var / www

After entering the phrase, you must enter a password to update the permissions. Now go to the file browser and find / var /. Right-click on the www folder and disable Sharing options.

To increase the security of folder sharing, you can set a password for them. If you want other users to have access to shared folders without entering a username and password, select the Guest Access option, although we suggest setting passwords for shared folders.

Selecting the Allow others to create and delete files option in this folder allows you to create and delete files in the shared folder. To be able to view the files, just go to //localhost/www.

Online server through port forwarding

. Now that you have identified your IP address, you need to go online. To do this, you must be familiar with a concept called Port Forwarding. Every user who connects to the Internet has an IP address.

In most home and business network-based connections, the computer IP does not connect directly to the Internet, so how should site visitors connect to the server?

This is done through a technique called port forwarding. Server ports are similar to house doors and windows, so they should be very secure. In the business world, each of an organization’s servers allows access to various services running on the servers. Web servers use port 80 by default.

To take advantage of the above feature, you must enter the IP address of your modem (sometimes this address is engraved on them. ) Go to the admin page and find the Port Forwarding or Applications section and finally forward the ports correctly.

Forward the TCP 80 port to the static IP address of your local network

. Some home modems connect to an Internet service provider with a dynamic IP address. This means that the public IP address changes after a specified period of time or when the router turns on and off.

To solve this problem, we must use the dynamic domain name system, which allows the use of the Internet address (URL) with the dynamic domain name system.

Using a client application (software that allows you to use server services) the Internet address will still be connected to the server when the public IP address changes.

In this case, visitors can refer to an address such as Forward the TCP 80 port to the static IP address of your local network. Some home modems connect to an Internet service provider with a dynamic IP address.

This means that the public IP address changes after a specified period of time or when the router turns on and off.

To solve this problem, we must use the dynamic domain name system, which allows the use of the Internet address (URL) with the dynamic domain name system.

Using a client application (software that allows you to use server services) the Internet address will still be connected to the server when the public IP address changes.

In this case, visitors can refer to an address such as Forward the TCP 80 port to the static IP address of your local network. Some home modems connect to an Internet service provider with a dynamic IP address.

This means that the public IP address changes after a specified period of time or when the router turns on and off.

To solve this problem, we must use the dynamic domain name system, which allows the use of the Internet address (URL) with the dynamic domain name system.

Using a client application (software that allows you to use server services) the Internet address will still be connected to the server when the public IP address changes.

In this case, visitors can refer to an address such as This means that the public IP address changes after a specified period of time or when the router turns on and off.

To solve this problem, we must use the dynamic domain name system, which allows the use of the Internet address (URL) with the dynamic domain name system.

Using a client application (software that allows you to use server services) the Internet address will still be connected to the server when the public IP address changes.

In this case, visitors can refer to an address such as This means that the public IP address changes after a specified period of time or when the router turns on and off.

To solve this problem, we must use the dynamic domain name system, which allows the use of the Internet address (URL) with the dynamic domain name system.

Using a client application (software that allows you to use server services) the Internet address will still be connected to the server when the public IP address changes.

In this case, visitors can refer to an address such as Using a client application (software that allows you to use server services) the Internet address will still be connected to the server when the public IP address changes.

Though, visitors can refer to an address such as Using a client application (software that allows you to use server services) the Internet address will still be connected to the server when the public IP address changes.

In this case, visitors can refer to an address such as visit your website http://yourhostname.dyndns.org.

Note that at the above address your hostname should be replaced with the name of the dedicated host you are considering. Some ISPs block the 80 router port. In such cases, you must forward a port such as port 8080 to port 80.

After doing this, you can open your site by entering the value: 8080 to the end of the address.

In this case, the site address is http://yourhostname.dyndns.org:8080.

Complete Linux webserver

After performing the above steps to use the server, you should focus on programming or installing the software you want. You may want to start a blog, or have several forums or sites, or plan to host some social networks.

In general, hosting any domain on the site is available, even on a computer you could not imagine