Ubantu系统调优篇

                Ubantu系统调优篇

                                          作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

 

 

 

 

一.网卡配置篇

1>.更新apt源

yinzhengjie@node210:~$ sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                               
Hit:2 http://cn.archive.ubuntu.com/ubuntu bionic InRelease                                                
Get:3 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]        
Get:4 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [517 kB]
Get:6 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [617 kB]
Get:7 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [937 kB]                                                                                                                                        
Get:8 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [925 kB]                                                                                                                                         
Fetched 3,248 kB in 33s (99.5 kB/s)                                                                                                                                                                                              
Reading package lists... Done
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ sudo apt-get update          #一般用户系统刚刚安装完毕,需要执行该操作,便于后期安装服务,但需要该主机连接互联网

2>.修改默认的网卡配置

yinzhengjie@node210:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


auto ens33
iface ens33 inet static
address 172.30.1.210
netmask 255.255.255.0
gateway 172.30.1.254
dns1 172.30.1.254
dns-nameservers 219.141.136.10
dns-nameservers 219.141.140.10
dns-nameservers 172.30.1.254
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ cat /etc/network/interfaces

3>.安装网络工具包

yinzhengjie@node210:~$ sudo apt-get -y install net-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
net-tools is already the newest version (1.60+git20161116.90da8a0-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 321 not upgraded.
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ sudo apt-get -y install net-tools
yinzhengjie@node210:~$ ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.30.1.210  netmask 255.255.255.0  broadcast 172.30.1.255
        inet6 fe80::20c:29ff:fea6:e1ca  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a6:e1:ca  txqueuelen 1000  (Ethernet)
        RX packets 3236  bytes 3446393 (3.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2184  bytes 195506 (195.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 193  bytes 16387 (16.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 193  bytes 16387 (16.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ ifconfig
yinzhengjie@node210:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.30.1.254    0.0.0.0         UG    0      0        0 ens33
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ens33
172.30.1.0      0.0.0.0         255.255.255.0   U     0      0        0 ens33
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ route -n
yinzhengjie@node210:~$ netstat -untalp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -                   
tcp        0     36 172.30.1.210:22         172.30.1.1:52736        ESTABLISHED -                   
tcp        0      0 172.30.1.210:22         172.30.1.1:52808        ESTABLISHED -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 ::1:631                 :::*                    LISTEN      -                   
udp        0      0 127.0.0.53:53           0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:631             0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:50293           0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -                   
udp6       0      0 :::45113                :::*                                -                   
udp6       0      0 :::5353                 :::*                                -                   
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ netstat -untalp

4>.安装sshd服务

yinzhengjie@node210:~$ sudo apt-get -y install openssh-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssh-server is already the newest version (1:7.6p1-4ubuntu0.3).
0 upgraded, 0 newly installed, 0 to remove and 321 not upgraded.
yinzhengjie@node210:~$ 
yinzhengjie@node210:~$ sudo apt-get -y install openssh-server          #默认ubantu并没有安装该软件,我们需要手动安装后,它会自动启动该服务

 

 

 

 

 

posted @ 2019-05-23 00:34  尹正杰  阅读(224)  评论(0编辑  收藏  举报