CentosMini安装后开启网卡,设置静态IP,安装python

编程

sudo fdisk -l 与本文无关

修改网卡

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

[root@bogon ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=dhcp

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=enp0s3

UUID=e68fb8ab-8ec6-42f1-83b4-bbd9b086dd29

DEVICE=enp0s3

ONBOOT=yes

[root@bogon ~]#

把ONBOOT改成yes

修改固定IP

cat /etc/sysconfig/network-scripts/ifcfg-enp0s3

有可能没有一个字段BOOTPROTO,或者它的值不是static

进行对应的修改:

    BOOTPROTO="static" #原值有可能是dhcp

再进行以下新增:

    IPADDR=192.168.199.66 #静态IP  

    GATEWAY=192.168.199.1 #默认网关  

    DNS1="192.168.254.1" #DNS

[root@bogon ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=static

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=enp0s3

UUID=e68fb8ab-8ec6-42f1-83b4-bbd9b086dd29

DEVICE=enp0s3

ONBOOT=yes

IPADDR=192.168.8.105

GATEWAY=192.168.8.1

DNS1=192.168.8.1

[root@bogon ~]#

[root@bogon ~]# service network restart

重启网络

[root@bogon ~]# service network restart

安装python3

先安装wget zlib* (python必须用的)

下载python安装包

[root@bogon ~]# wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz

[root@bogon ~]# tar -zxvf Python-3.6.3

[root@bogon ~]# yum -y install wget

[root@bogon ~]# yum -y install zlib*

[root@bogon ~]# yum -y install gcc

[root@bogon ~]# mkdir /usr/local/python3

[root@bogon ~]# cd Python-3.6.3/

[root@bogon ~]#./configure --prefix=/usr/local/python3

[root@bogon ~]#make

[root@bogon ~]#make install

[root@bogon ~]#rm /usr/bin/python

[root@bogon python3]# ln -s /usr/local/python3/bin/python3 /usr/bin/python

[root@bogon python3]# python -V

Python 3.6.3

安装pip3(无用,参考)

[root@bogon ~]#wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26

[root@bogon ~]# tar -zxvf setuptools-19.6.tar.gz

[root@bogon ~]# cd setuptools-19.6

[root@bogon setuptools-19.6]# python setup.py build

[root@bogon setuptools-19.6]# python setup.py install

安装aws client

https://docs.aws.amazon.com/zh_cn/cli/latest/userguide/install-cliv2-linux.html

以上是 CentosMini安装后开启网卡,设置静态IP,安装python 的全部内容, 来源链接: utcz.com/z/511779.html

回到顶部