y0ngb1n

Aben Blog

欢迎来到我的技术小黑屋ヾ(◍°∇°◍)ノ゙
github

Upgrade idle computers to personal servers Ubuntu 18.04.2 LTS (Bionic Beaver)

Preface#

Since my friend Hong left behind a dusty desktop computer at the university, I decided to use it for some tinkering and make it shine. So, with Hong's permission, I decided to replace the system with Ubuntu 18.04.2 LTS (Bionic Beaver) Server version, and set up a home environment that is suitable for both learning and entertainment. It will mainly be used as a server for development and learning purposes 👊.

I will use it to build my Home Lab and run some services including but not limited to:

ServiceDescription
nginx-proxyDocker-based automated gateway
Pi-holeAd filtering for home
GitLabPrivate code repository
JenkinsContinuous integration engine
BitwardenPrivate password manager
......

More services will be maintained in the future at "y0ngb1n/dockerized". Feel free to give it a star 🌟.

Get Ubuntu System#

You can obtain the Ubuntu 18.04.2 LTS (Bionic Beaver) system image from any of the following sources:

SourceSite
Ubuntu Official Websitehttp://releases.ubuntu.com/18.04/
Alibaba Open Source Mirror Sitehttps://mirrors.aliyun.com/ubuntu-releases/18.04/
Tsinghua University Open Source Software Mirror Sitehttps://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/18.04/

The file I want to download is named ubuntu-18.04.2-live-server-amd64.iso, and the download link is https://mirrors.aliyun.com/ubuntu-releases/18.04/ubuntu-18.04.2-live-server-amd64.iso. I will use the mirror site of Alibaba. The file size is 834.00 MB.

Install Ubuntu System#

Before installing the system, you need to prepare a USB flash drive with a capacity of more than 4G and a handy image burning tool (I choose Etcher).

Step 1: Get Etcher#

Flash OS images to SD cards & USB drives, safely and easily.

Etcher is an open-source fast burning software that allows you to quickly create USB image tools. It has a simple and stylish interface, and it can help you quickly burn system image files (such as .iso, .img, .dmg, .zip, etc.) into USB devices (flash drives) or SD cards. You can download the latest version of Etcher here.

Etcher App

The interface is clean and the operation is simple, with three steps:

  1. Select the image file
  2. Select the disk
  3. Start burning

Step 2: Create a System Boot Disk#

Connect the USB flash drive to the computer, open Etcher, select the downloaded system image and the USB flash drive, and then click the Flash! button. Let Etcher do the rest.

Step 3: Install Ubuntu System#

Turn off the host computer to be installed with the system, and connect the USB flash drive, keyboard, and monitor. After powering on, press Escape, F2, F10, F12, or pay attention to the prompt on the screen (this varies depending on the machine, you can Google it yourself). My motherboard is ASUS, and it prompts me to press the F2 or DEL key to enter the BIOS system. The main thing is to set our USB flash drive as the first boot disk and load the USB flash drive first, so that we can install the system.

After successfully booting from the USB flash drive, you can refer to the installation guide provided by Ubuntu, "Install Ubuntu Server", for installation operations. At the step of setting the mirror, you can use Alibaba Cloud's public mirror service and enter http://mirrors.aliyun.com/ubuntu/, which can speed up your installation process. Otherwise, it will default to the official source.

Finally, just wait for the installation to complete! 👏 Yes, just wait.

Step 4: Log in to the System#

$ ssh [email protected]
yangbin@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

That's it! 🐶


Configure the Basic Environment of the System#

After installing the system, let's do some simple configurations.

Configure Software Sources#

It is recommended to use Alibaba Cloud's source. First, create your own configuration file, for example:

/etc/apt/sources.list.d/aliyun.list

Edit the content as follows:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Then execute:

sudo apt-get update

Configure Time Zone#

Don't forget to configure the system time zone, especially now that it is popular to mount the system time zone in containers.

$ dpkg-reconfigure tzdata  # Use the command line interactive interface to modify

Current default time zone: 'Asia/Shanghai'
Local time is now:      Fri May  3 20:59:14 CST 2019.
Universal Time is now:  Fri May  3 12:59:14 UTC 2019.

Install Container Environment#

One-Click Installation of Docker

Install Docker using Alibaba Cloud's acceleration:

curl -fsSL get.docker.com -o get-docker.sh && \
sudo sh get-docker.sh --mirror Aliyun

Start Docker CE

sudo systemctl enable docker && \
sudo systemctl start docker

One-Click Installation of Compose

Since Compose is a Python application, you can also execute it directly in a container:

export DOCKER_COMPOSE_VERSION=1.24.0
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/run.sh > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Configure Container Image Source

mkdir -p /etc/docker && touch /etc/docker/daemon.json

cat <<EOF > /etc/docker/daemon.json
{
    "registry-mirrors": [
        "https://registry.docker-cn.com"
    ]
}
EOF

sudo systemctl start docker

For more configurations, refer to "Ubuntu 18.04 Basic System Configuration" to unlock more possibilities.


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.