In the spring of 2020, due to the influence of the new Corona, it became difficult to go out even in GW. I was thinking of taking advantage of this situation. For example Do you use AWS? I don't want to be charged or managed if left unattended. How about Python program development? And I have to think about the material. Buy a Raspberry Pi and learn the basics of embedded systems ... I can't afford it! Then, when I looked around the house, I found that the notebook PC I had given to my child was no longer in use. It's an old notebook PC, but I thought that there might be no problem if it was used as a server, so I decided to use it on my home server.
Good point ...
-If you build a server with a notebook PC and the battery is normal, you will have some power outage measures. There haven't been many power outages these days, so I don't have to worry about it anymore, but just in case. -The notebook PC is designed to save power. (However, it may not be relevant on older laptops) Also, since a lot of this kind of information has already been talked about, I will link to the site I referred to for the details after this. (Please note that it will be a memorandum at the time of my construction.) I hope you can refer to it in the procedure at the time of construction. Also, if you notice any mistakes or improper settings, I would appreciate it if you could comment.
FMV BIBLO NF / D50 Made in 2009 CPU: Core 2 Duo P8700 2.53GHz / 2 core I used the original windows Vista as Windows10. HDD has been changed to SSD128Gbyte. Memory 4Mbyte DVD drive + 1 LAN port + Wifi
The Linux to be installed is Ubuntu 18.04 Desktop version. There are other options for CentOS, but I chose it from the old memory that Ubuntu was good for notebook PCs and I thought that a different one would be good because I use it in my daily work. The laptop has the data used by the child deleted after the transfer to the new laptop.
The C drive of the notebook PC had a capacity of about 100 Gbyte, and various data such as windows 10 remained. Free space is about 60 Gbyte. I don't want to delete Windows itself (I don't want to install windows10 installation again at a later date due to malfunction etc.), so first delete unnecessary files. The method is to execute "Clean up disk" in the properties of C drive and delete unnecessary files. The file was deleted though it was about 1GByte.
Download Ubuntu 18.04 from the official Ubuntu website. (From here https://jp.ubuntu.com/download) (The latest version is 20.04 version, but I dare to select the previous LTS. = Safety first) (If you want to try a new function, I would like to try it on my PC in a virtual environment.) (Since it is new, I will omit the detailed explanation.) After downloading the ISO on Windows 10, burning the ISO to DVD was possible with Explorer standard features. (We no longer download the dedicated app like before.) Delete the downloaded ISO and shut down windows. There is also a way to create boot media on USB, but I didn't have the essential USB at hand, so I gave it up this time.
Change the BIOS settings so that the PC boots from the DVD. In the case of FMV, if you press "F2" repeatedly after turning on the power, it will start in BIOS mode. For subsequent operations, check the manufacturer's manual.
When you reboot and boot from the DVD, you will have the choice of installing or using the LiveDVD, so this time click "LiveDVD" and wait for it to finish booting. (It takes about 5 minutes)
Start Gpart and reduce the size of NTFS in the area of windows10 (about 110Gbyte) to 50Gbyte. Shrinking the DISK area will fail in some cases, so wait for it to finish normally. After the message that it ended normally is displayed, quit Ubuntu and start Windows. Confirm that Windows starts normally and you can log in. If all goes well, quit Windows and boot from the DVD again.
When you start the DVD, you will be asked to install it again or use the LiveDVD, so select install this time. The selection in the installation proceeds by default. Details have already been posted on many sites, so please check for reference. After installation, start with Ubuntu 18.04 and confirm that you can log in as the initial creation user.
Since the OS installation was completed without any problems, make simple settings and change it to a state where it can be used as a temporary server.
Since the IP address changes depending on the router at home, connect to the management screen of the router with a browser and check it.
When installing Ubuntu Desktop, I used Wifi to enter the SSID and password in the network settings. If nothing is done, the IP address of the server is not fixed, so the IP address may change in the event of a power failure or restart of the router. Change the Wifi IP address from "Settings" and change from automatic acquisition to manual setting. Similarly, the LAN port is automatically acquired and then set manually. Leave IPv6 as it is. (I will touch it sometime))
The editor I use to change settings uses vim. Install vim with the following command.
# apt install vim
On laptops with Ubuntu Desktop installed, the OS is set to suspend when the LCD display is closed. It seems that the setting cannot be changed from the "Settings" screen of the normal window, so I changed it to a setting that does not suspend by referring to the following site. Reference: [Ubuntu 20.04 / 18.04 LTS Server] Prevents suspend even when the lid is closed on a laptop Operation outline: Edit /etc/systemd/logind.conf.
Copy the line #HandleLidSwitch = suspend and paste it below Change to HandleLidSwitch = ignore.
Restart the service.
# systemctl restart systemd-logind
Make sure that you do not actually close the LCD display and suspend it. (Meal break during that time)
Set up the ssh environment to log in from a windows terminal. The first time, login authentication is a password to connect for setting change. When connecting from the outside and using it, set ssh key authentication and set it more strictly.
# apt -y install openssh-server
By default, Ubuntu's OpenSSH server allows password authentication, but root users are prohibited from password login. Here, further change the login settings of ssh so that the root user cannot log in with ssh.
# vi /etc/ssh/sshd_config
Restart the ssh service.
# systemctl restart ssh
Since windows10 version 1803 or later has an ssh client, start a command prompt.
C: \ ******> ssh username @ server IP address Username @ server IP address's password:
Is displayed, and I was able to log in by entering the password.
Ubuntu18.04 Desktop version does not include net-tool commands (ifconfig, netstat, etc.). However, iproute2 commands (ip, tc, ss, etc.) can be used. I'm used to net-tool commands, so I'll install it additionally.
# apt install net-tools
For network commands, refer to the following. net-tools may no longer be used and iproute2 may become standard
For use only at home, I think that it can be used first if the above settings are made. In the future, you can use it in various ways by installing the missing packages as needed. As for the elapsed time up to this point, it takes about half a day to prepare a notebook PC and set it as a home server. (The big problem was that it took 3 days to record at the time of construction and post to Qiita.)
Security is not set too much to use from outside the home, so I plan to do the following ・ Iptables settings ・ I want to set IDS if possible. ・ Ssh key authentication settings ・ DMZ setting of home router ・ Access your home server from an external network -Web server settings
We will update it as soon as the above is done.