Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ubuntu-16.04.6-server installation, system optimization and upgrade to 18.0.4

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. ubuntu-16.04.6-server-amd64 Security and LVM Subarea steps

Choose the English language

Install Ubuntu Server

Choose English

Select United States

Do not test the keyboard

Choose an English keyboard

Press ENTER

Set up an account

Confirm the password twice

Select YES and continue to use a weak password (it is recommended that you set it to a high-complexity password in the formal environment).

Whether to encrypt the user directory, select No.

Choose the eastern time zone without changing it.

Select manual partition to continue.

Create an empty partition first, as shown below:

Select the empty partition you just created and press enter.

To create a new partition, first create the boot partition of 200MB.

Boot partition assigns 200MB.

Select Primary Partition

Choose Beg

Select the mount point as / boot

Then create the second primary partition

Continue to create the primary partition

Enter directly and allocate all the space to the second main partition.

Enter to proceed to the next step.

Select the logical volume manager for VG and LV creation.

Enter directly and write to disk.

Create a volume group, named VolGroup

Select the second disk and enter directly.

Select YES,ENTER

Then create a logical volume

Pioneering three LV of swap/root/data

Select the volume group VolGroup and enter.

Create swap

Allocate 5G space to SWAP

Follow the steps above to complete the LV creation of the root partition and data partition.

Then set the logical volume mount point and file format.

All done the LV partition is as follows

Enter and complete the partition for the next installation.

If you need an agent to enter IP online, you will not enter directly.

Press Enter

I am for a virtualized environment. I can choose the following two directly.

A total of 236 installation packages can be installed in two or three minutes, and the next step is to enter directly.

Press enter completes the installation.

After the installation is complete, the startup screen is as follows:

II. Ubuntu Sever 16 optimization

Modify network interface name, disable IPv6 and unnecessary network interface

Modify the name of the network card to eth0

Vi / etc/default/grub found GRUB_CMDLINE_LINUX= "" and changed it to

GRUB_CMDLINE_LINUX= "net.ifnames=0 biosdevname=0"

Then execute sudo grub-mkconfig-o / boot/grub/grub.cfg

Vi / etc/network/interfaces

Modify ens192 to eth0

After reboot, the name of the Nic becomes eth0.

If the system is Ubuntu 18.04or above, the following files need to be modified.

Vi / etc/netplan/*.yaml

Network:

Ethernets:

Eth0:

Addresses: []

Dhcp4: true

Version: 2

Disable IPv6

Vi / etc/sysctl.d/99-sysctl.conf

Copy and paste the following 3 lines at the bottom of the file.

Net.ipv6.conf.all.disable_ipv6 = 1

Net.ipv6.conf.default.disable_ipv6 = 1

Net.ipv6.conf.lo.disable_ipv6 = 1

Save and close the file. Then execute the following command to load the above changes.

Sudo sysctl-p

Root@ubuntu:~# vi / etc/sysctl.d/99-sysctl.conf

Root@ubuntu:~# sudo sysctl-p

Net.ipv6.conf.all.disable_ipv6 = 1

Net.ipv6.conf.default.disable_ipv6 = 1

Net.ipv6.conf.lo.disable_ipv6 = 1

Root@ubuntu:~# cat / proc/sys/net/ipv6/conf/all/disable_ipv6

one

Delete the virbr0 virtual network card and disable the bridge

Delete VIRBR0

Ifconfig virbr0 down

Brctl delbr virbr0

Systemctl disable libvirtd.service

Disable Brid

Virsh net-destroy default

After completing the above four steps, the test is as follows:

Boot Partition Kernel cleaning

Uname-a view the currently running kernel

Dpkg-- get-selections | grep linux-image to view all kernel versions

Sudo apt-get purge linux-image-4.10.0-28-generic migration unless currently using version

2. The default update source for Ubuntu is foreign, and if necessary, it can be changed to domestic update source.

Sudo cp / etc/apt/sources.list / etc/apt/sources.list_backup

> / etc/apt/sources.list

Vi / etc/apt/sources.list CP the following contents into the sources.list file

Deb http://mirrors.aliyun.com/ubuntu trusty main restricted

Deb-src http://mirrors.aliyun.com/ubuntu trusty main restricted

# # Major bug fix updates produced after the final release of the

# # distribution.

Deb http://mirrors.aliyun.com/ubuntu trusty-updates main restricted

Deb-src http://mirrors.aliyun.com/ubuntu trusty-updates main restricted

# # N.B. Software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

# # team. Also, please note that software in universe WILL NOT receive any

# # review or updates from the Ubuntu security team.

Deb http://mirrors.aliyun.com/ubuntu trusty universe

Deb-src http://mirrors.aliyun.com/ubuntu trusty universe

Deb http://mirrors.aliyun.com/ubuntu trusty-updates universe

Deb-src http://mirrors.aliyun.com/ubuntu trusty-updates universe

# # N.B. Software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

# # team, and may not be under a free licence. Please satisfy yourself as to

# # your rights to use the software. Also, please note that software in

# # multiverse WILL NOT receive any review or updates from the Ubuntu

# # security team.

Deb http://mirrors.aliyun.com/ubuntu trusty multiverse

Deb-src http://mirrors.aliyun.com/ubuntu trusty multiverse

Deb http://mirrors.aliyun.com/ubuntu trusty-updates multiverse

Deb-src http://mirrors.aliyun.com/ubuntu trusty-updates multiverse

# # N.B. Software from this repository may not have been tested as

# # extensively as that contained in the main release, although it includes

# # newer versions of some applications which may provide useful features.

# # Also, please note that software in backports WILL NOT receive any review

# # or updates from the Ubuntu security team.

Deb http://mirrors.aliyun.com/ubuntu trusty-backports main restricted universe multiverse

Deb-src http://mirrors.aliyun.com/ubuntu trusty-backports main restricted universe multiverse

Deb http://security.ubuntu.com/ubuntu trusty-security main restricted

Deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted

Deb http://security.ubuntu.com/ubuntu trusty-security universe

Deb-src http://security.ubuntu.com/ubuntu trusty-security universe

Deb http://security.ubuntu.com/ubuntu trusty-security multiverse

Deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

Then execute the following command to refresh:

Sudo apt-get clean

Sudo apt-get update

Upgrade Ubuntu Server 16 to Ubuntu Server 18

1. Confirm the current version

Root@ubuntu-template:/home/ncadmin# uname-r

4.4.0-151-generic

Root@ubuntu-template:/home/ncadmin# cat / etc/lsb-release

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=16.04

DISTRIB_CODENAME=xenial

DISTRIB_DESCRIPTION= "Ubuntu 16.04.6 LTS"

Root@ubuntu-template:/home/ncadmin#

Update ensures that the official update source is used and that apt update & & apt upgrade is executed without error reporting

two。 Then execute the do-release-upgrade command to upgrade

Root@ubuntu-template:/home/ncadmin# do-release-upgrade

Checking for a new Ubuntu release

Get:1 Upgrade tool signature [819 B]

Get:2 Upgrade tool [1245 kB]

Fetched 1246 kB in 0s (0 Bamp s)

Authenticate 'bionic.tar.gz' against' bionic.tar.gz.gpg'

Extracting 'bionic.tar.gz'

Reading cache

Checking package manager

Continue running under SSH?

This session appears to be running under ssh. It is not recommended

To perform a upgrade over ssh currently because in case of failure it

Is harder to recover.

If you continue, an additional ssh daemon will be started at port

'1022 yuan.

Do you want to continue?

Continue [yN] y

Follow the prompts to complete the update, there is no need to repeat the detailed steps!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report