In this article, I tried to of setting up a website on a personal computer write more about Linux, network and server and related tasks The procedure I used is not considered a standard procedure, but it can be a good reference for setting up a personal Linux web server for personal tasks or even more important tasks.
The important thing that is not observed in most of the Persian and English guides is that the author of these articles (which is in the introductory category) is usually a Linux professional and there are a series of assumptions in his mind and whatever he tries to put himself in the place of newbies. Again, he cannot see the small details;
But this article is not written by such a person, I worked with Linux for fun in the last few years through raspberry and small IOT tasks, and if you are a beginner, you can count on what I say, because there is not much difference between me and you. As far as I can, I have explained the concepts that I think need to be explained for newbies, or if I screw up, I will mention that I am screwing up; It means you don’t miss anything, at least you know what you don’t know!
- If you don’t know anything about Linux, if you don’t know how a site works and what a web server is, but you are interested in knowing it, this article will help you.
- If you are a programmer and you were only involved in the code and publishing steps are not very important to you, but you like to learn about web servers, this article will be useful for you.
The links used in this article are from the best sources, it’s not just a matter of Googling and linking, and they must have been read at least once if they have not been implemented.
- An unused system (I had an old laptop and used it as an injured one, if you don’t have an additional system, you can use virtualization software and bring up a “virtual server”. The process of installing virtualization tools and installing an operating system on them is a simple task. I think you should read the instructions of this link or watch this video and implement it once and then read this article.)
- Ubuntu server file (download the LTS version from here . This version has long-term support and is the same advantage over the latest version)
- An empty flash drive
- Modem connected to the Internet and network cable to connect the system directly to the Internet during installation
- rufus software (assuming that you are working with Windows, this software will create a bootable flash for you based on the Ubuntu installation files. To make the flash bootable, you need a DVD or CDB.)
Preparing ubuntu server flash memory and starting installation
Boot your flash drive with ubuntu server content.
Appearance of rufus software
Choose your flash path from the Device section. Select the ubuntu server download file from the Boot selection section. Ignore the rest and press the Start button.
After the flash memory is ready, press the Close button and transfer your flash to the system you want to be Linux. Make sure that the system boot drive is set with flash memory priority. To do this, use the DEL or F2 button when the computer is turned on to run the system setup.
Your system setup is something like this!
Go to the Boot section and you will see a screen like the one below, with the buttons mentioned below, give the first priority of your boot to the flash memory (Removable Devices) instead of the CD or disk drive.
For example, in this system, the priority changes with the + and – buttons. (bottom of the page)
After saving and exiting the system setup, your computer will start with flash boot and you will see a picture like the one below. ( source of installation description and pictures)
Start the installation by selecting the language
After choosing the language, you need to choose your keyboard. Without changing, press done to go to the next step.
Select the keyboard
Then you will see the following options, naturally you choose the first option.
The installer tests your network connection. Your system must be connected to the modem with a cable so that the installation program can assign an IP to your system. For now, we choose the default mode, later we can define a static IP.
Select the default mode for IP allocation
In the next step, you select the partition on which you want to install or select the whole disk mode (the first option).
Different modes of installation on disk
If you choose the first option, you will not have anything special to do.
But the manual option allows you to adjust the size of each partition. This article suggests the following.
Suggestions for partitions, if you have selected the manual option.
In manual mode, you will see a new page for each partition, and you have to press the create button to create it. In user an entire disk mode, just do the steps.
In the next step, it will ask for your details.
Be careful in choosing the server name and username because it will always be in front of your eyes!
And finally the installation will start.
Installation operation Finish installation and reboot the system
After the system is booted, you must first login and then enter your password.
The server is ready.
Communication with the server through other computers on the network
Basically, it is not right to always be directly next to the server. It is better to be able to control and manage the server remotely with the system you always work with.
There are several ways to do this. They use telnet for login or FTP for file transfer, but something that has high security is called SSH. With the help of SSH, you can establish a secure connection through an insecure network. You will have access to your terminal server. Installing SSH on the server is easy. We need to install SSH Server on our Linux server and use SSH Client like putty on our windows to connect to the server. (My assumption is that your other system is Windows, if you have Linux on that system, this connection can be established through the terminal)
In the terminal of your Linux server (previous image), write the following command:
1 sudo apt-get update
sudo means super user does what we want to do
apt-get stands for advanced package tool, which is an interface for working with libraries. With the help of this command, we get the libraries we need through the Internet.
Update means update the list of all the packages we have and get the information about their new version. We just updated the package repositories lists.
We write the following command:
1 sudo apt-get upgrade
With the upgrade command, new packages are installed. In fact, after updating the list of packages, the package manager will be notified of the available updates and these updates will be done with the upgrade command.
Now it’s time to install openssh.
1 sudo apt-get install openssh-server
By installing the above package, ssh server will be installed, now you need to configure the server. Open the configuration file with the following command and make sure that Port 22 is not commented (the lines that start with # are comments).
We also add MaxAuthorize 4 as shown in the image (if it doesn’t exist).
1 sudo nano /etc/ssh/ssh_config
Make sure that the above lines are not commented.
We check the server status as follows:
1 sudo service ssh status
The status that shows that the ssh server is active.
If it is not active, you can activate and deactivate the ssh server as follows.
1 sudo service ssh start
1 sudo service ssh stop
With the help of the following command, we can find out the IP address of the Linux server.
A sample image of the result of ifconfig in the eth0 header, which indicates the type of cable connection and the IP address is 192.168.1.13.
Because our connection is currently with a cable, our output will be in the form of the image above. We write down our IP. (WiFi connection will be explained below)
On the Windows side (where we want to connect to the Linux server), we download and install the putty software from here . After execution, we will see a picture as below.
Enter the Linux server IP with port 22. ssh option is selected.
By clicking on open, a terminal window should open that asks us for the Linux user and password. The command line is ready for your commands!
The Linux terminal that is available to you through putty.
If the connection is not established and, for example, we see a connection timeout error in putty, it is better to check the connection of the Windows system as a client with the Linux server through ping. Also, on the contrary, check this connection through ping on the Linux server. In a Windows server, the ipconfig command should be used to find out the IP address. (instead of ifconfig).
1 ping 192.168.1.6
Make sure there is no problem with port 22 on the Windows firewall, or temporarily disable your firewall as soon as you are sure.