s
centos7开启网卡功能
https://blog.csdn.net/nkd50000/article/details/78903479
网卡默认是关闭的,未分配ip地址,解决办法:
1、修改文件 vim /etc/sysconfig/network-scripts/ifcfg-enp1s0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp1s0
UUID=b95a3321-61d6--b648-16c6ec073738
DEVICE=enp1s0
ONBOOT=no
2、找到内容 ONBOOT=no ,需要修改为ONBOOT=yes然后保存退出。
3、service network restart #重启网络服务
CentOS7.2 创建本地YUM源和局域网YUM源
https://www.cnblogs.com/nidey/p/6200685.html
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@localhost ~]# mount -t iso9660 /opt/soft/CentOS-7-x86_64-DVD-1611.iso /mnt/CentOS7/
或
[root@localhost ~]# mount -t auto /opt/soft/CentOS-7-x86_64-DVD-1611.iso /mnt/CentOS7/
[root@localhost ~]# pwd /etc/yum.repos.d
创建yum repo文件如下
[root@localhost ~]# more lindows.repo
[lindows.iteye.com]
name=local
baseurl=file:///mnt/CentOS7
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
OS + CentOS 7.3.1611 / docker 安装
第一步, 配置yum docker更新源
文件:/etc/yum.repos.d/CentOS7_15090385.repo
内容:
[dockerrepo]
name=Docker Repository
baseurl=http://10.27.97.35/docker/centos/7/
enabled=
gpgcheck= [centosrepo]
name=CentOS Repository
baseurl=http://10.27.97.35/centos/7/x86_64/
enabled=
gpgcheck= [update]
name=update
baseurl=http://10.27.97.35/centos/7/updates/x86_64/
enabled=
gpgcheck= [update-os]
name=update-os
baseurl=http://10.27.97.35/centos/7/os/x86_64/
enabled=
gpgcheck= [3rdparty]
name=3rdparty
baseurl=http://10.27.97.35/centos/7/3rdparty/
enabled=
gpgcheck=
第二步,开始安装
1 [root@SCTS-PC-DEV yum.repos.d]# yum list *docker*
9 [root@SCTS-PC-DEV yum.repos.d]# docker pull registry
10 bash: docker: command not found...
11 [root@SCTS-PC-DEV yum.repos.d]# yum install *docker*
24 ================================================================================================================================
25 Package Arch Version Repository Size
26 ================================================================================================================================
27 Installing:
28 docker-engine x86_64 17.03.0.ce-4.sn.el7.centos dockerrepo 18 M
29 docker-engine-debuginfo x86_64 17.03.0.ce-4.sn.el7.centos dockerrepo 1.5 M
30 docker-engine-selinux noarch 17.03.0.ce-4.sn.el7.centos dockerrepo 27 k
31 docker-macvlan x86_64 0.1.1-1.sn.el7.centos dockerrepo 2.1 M
64 Installed:
65 docker-engine.x86_64 0:17.03.0.ce-4.sn.el7.centos docker-engine-debuginfo.x86_64 0:17.03.0.ce-4.sn.el7.centos
66 docker-engine-selinux.noarch 0:17.03.0.ce-4.sn.el7.centos docker-macvlan.x86_64 0:0.1.1-1.sn.el7.centos
68 Complete!
71 [root@SCTS-PC-DEV yum.repos.d]# docker version
72 Client:
73 Version: 17.03.0-ce.4.sn
74 API version: 1.26
75 Go version: go1.7.5
76 Git commit: 3f2f131-unsupported
77 Built: Thu Aug 3 17:16:43 2017
78 OS/Arch: linux/amd64
79 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
docker 自建仓库
1、有台ubuntu 14.10.4 LTS 已经安装了docker registry
vagrant@vagrant-ubuntu-trusty-64:~$ ps -ef | grep reg
root 1856 1 0 Oct30 ? 00:13:14 /usr/bin/docker -d --insecure-registry 10.24.41.95:5000
2、有台CentOS 7.3 只安装了docker 软件,yum install *docker*
新增文件:
[root@SCTS-PC-DEV docker]# vim /etc/docker/daemon.json
文件内容:
{
"insecure-registries":["10.24.41.103:5000"]
}
启动docker 仓库
[root@SCTS-PC-DEV docker]# /bin/systemctl restart docker.service
[root@SCTS-PC-DEV docker]# docker pull registry
[root@SCTS-PC-DEV docker]# docker run -d -p 5000:5000 -v /data/soft/registry:/tmp/registry 10.24.41.95:5000/registry:latest
[root@SCTS-PC-DEV docker]# docker ps -a
docker验证:
http://10.27.188.103:5000/v2/_catalog 返回 {"repositories":[]}
http://10.27.188.103:5000/v1/repositories/mystf/stf/images
查看images
docker images
docker push 10.27.188.110:5000/mystf/stf 提交镜像
docker pull 10.27.188.110:5000/mystf/stf:latest 获取镜像
end
OS + CentOS / mount / unmount / fdisk / vfat / exFAT / ntfs / iso
centos 7.3 下挂载ISO文件,让开启自启动挂载
参考:CentOS 7添加开机启动服务/脚本
http://www.linuxidc.com/Linux/2016-12/138079.htm
一、添加开机自启服务
在CentOS 7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例):
systemctl enable jenkins.service #设置jenkins服务为自启动服务
sysstemctl start jenkins.service #启动jenkins服务
二、添加开机自启脚本
在centos7中增加脚本有两种常用的方法,以脚本autostart.sh为例:
#!/bin/bash
#description:开机自启脚本
/usr/local/tomcat/bin/startup.sh #启动tomcat
方法一
、赋予脚本可执行权限(/opt/script/autostart.sh是你的脚本路径)
chmod +x /opt/script/autostart.sh
、打开/etc/rc.d/rc/local文件,在末尾增加如下内容
/opt/script/autostart.sh
、在centos7中,/etc/rc.d/rc.local的权限被降低了,所以需要执行如下命令赋予其可执行权限
chmod +x /etc/rc.d/rc.local
方法二
、将脚本移动到/etc/rc.d/init.d目录下
mv /opt/script/autostart.sh /etc/rc.d/init.d
、增加脚本的可执行权限
chmod +x /etc/rc.d/init.d/autostart.sh
、添加脚本到开机自动启动项目中
cd /etc/rc.d/init.d
chkconfig --add autostart.sh
chkconfig autostart.sh on
以上两种方法均已在centos7系统上验证过,
[root@CNHS-SCTS-APP06 ~]# mkdir -p /mnt/CentOS73
[root@CNHS-SCTS-APP06 ~]# chmod +x /etc/rc.d/rc.local
修改文件:/etc/rc.d/rc.local
新增内容:
sudo mount -t iso9660 -o loop /opt/soft/CentOS-7-x86_64-DVD-1611.iso /mnt/CentOS73/
[root@CNHS-SCTS-APP06 ~]# reboot
centos 7.3 下挂载U盘和移动硬盘
http://blog.csdn.net/u010048823/article/details/51306175
linux如何挂载U盘
http://jingyan.baidu.com/article/f0062228dc2aa6fbd3f0c8ec.html
1、向CentOS机器插入U盘 ,检查U盘文件类型Fat32 、exFat、NTFS还是其他。
[root@CNHS-SCTS-APP06 ~]# fdisk -l
Disk /dev/sda: 31.7 GB, 31675383808 bytes, 61865984 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ace03
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 61865983 29883392 8e Linux LVM
Disk /dev/mapper/cl-root: 27.4 GB, 27426553856 bytes, 53567488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/cl-swap: 3166 MB, 3166699520 bytes, 6184960 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 15.6 GB, 15552479232 bytes, 30375936 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xcad4ebea
Device Boot Start End Blocks Id System
/dev/sdb4 * 256 30375935 15187840 c W95 FAT32 (LBA)
2、查看U盘文件类型是Fat32 、exFat、NTFS还是其他。
本次U盘类型为FAT32: /dev/sdb4 * 256 30375935 15187840 c W95 FAT32 (LBA)
3、创建/mnt/u_disk 挂载目录,准备给U盘挂载
[root@CNHS-SCTS-APP06 ~]# mkdir -p /mnt/u_disk
3、创建/mnt/u_disk 挂载目录,开始给U盘挂载,挂载ok!
[root@CNHS-SCTS-APP06 ~]# mount -t vfat /dev/sdb4 /mnt/u_disk
4、若是NTFS 文件的u盘则如下挂载方法
4.1、先安装CentOS7.3 系统 支持NTFS 文件类型
[root@CNHS-SCTS-APP06 ~]# yum list *ntfs*
[root@localhost udisk]# yum list *ntfs*
已加载插件:fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
……
可安装的软件包
findntfs.x86_64 1.3-1.el7.rf rpmforge
fuse-ntfs-3g.x86_64 2013.1.13-2.el7.rf rpmforge
fuse-ntfs-3g-devel.x86_64 2013.1.13-2.el7.rf rpmforge
ntfs-3g.x86_64 2:2016.2.22-1.el7 epel
ntfs-3g-devel.x86_64 2:2016.2.22-1.el7 epel
ntfsprogs.x86_64 2:2016.2.22-1.el7 epel
[root@CNHS-SCTS-APP06 ~]# yum install fuse-ntfs-3g
4.2、再挂载U盘
[root@CNHS-SCTS-APP06 ~]# mount -t ntfs-3g /dev/sdb4 /mnt/u_disk
OS + CentOS / date / localtime / /usr/share/zoneinfo/Asia/Shanghai
CentOS 7.3 时区格式不对,重新调整为CST
[root@CNHQ-SCTS-APP03 ~]# date
Wed Aug 15 22:40:18 EDT 2017
[root@CNHQ-SCTS-APP03 ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@CNHQ-SCTS-APP03 ~]# date
Wed Aug 16 22:40:18 CST 2017
OS + CentOS / systemctl / firewalld / firewalld.service
CentOS 7.0关闭默认防火墙启用iptables防火墙
http://www.linuxidc.com/Linux/2015-05/117473.htm
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。
1、关闭firewall:
[root@cnhq-scts-app28 ~]# systemctl stop firewalld.service #停止firewall
[root@cnhq-scts-app28 ~]# systemctl disable firewalld.service #禁止firewall开机启动
[root@cnhq-scts-app28 ~]# firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
- 获得root 控制权限。在“#”下操作。
- 查看防火墙状态。
systemctl status firewalld
- 临时关闭防火墙命令。重启电脑后,防火墙自动起来。
systemctl stop firewalld
- 永久关闭防火墙命令。重启后,防火墙不会自动启动。
systemctl disable firewalld
- 打开防火墙命令。
systemctl enable firewalld
OS + CentOS / systemctl / network
重启网卡
[root@SCTS-PC-DEV ~]# systemctl restart network
案例二:CentOS 7.3.1611 64位 ping不通域名地址问题解决 / 动态分配地址解决方法
centos下问题:connect:network is unreachable
http://www.cnblogs.com/valu/p/6515991.html
CentOS 7.0 网卡配置及重命名教程
http://www.linuxidc.com/Linux/2017-05/143287.htm
- 第一步,查询本地路由表信息
- [root@SCTS-PC-DEV rc.d]# route
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 10.19.252.84 10.24.41.254 255.255.255.255 UGH 100 0 0 enp3s0
- 10.24.41.0 0.0.0.0 255.255.255.0 U 100 0 0 enp3s0
- 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
- 第二步,添加默认网关,就好了。
- [root@SCTS-PC-DEV rc.d]# route add default gw 10.24.41.254
- [root@SCTS-PC-DEV rc.d]# route
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- default gateway 0.0.0.0 UG 0 0 0 enp3s0
- 10.19.252.84 gateway 255.255.255.255 UGH 100 0 0 enp3s0
- 10.24.41.0 0.0.0.0 255.255.255.0 U 100 0 0 enp3s0
- 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
- 第三步,能ping通外部IP地址和域名地址了
- [root@SCTS-PC-DEV rc.d]# ping 192.168.118.201
- PING 192.168.118.201 (192.168.118.201) 56(84) bytes of data.
- 64 bytes from 192.168.118.201: icmp_seq=1 ttl=55 time=1.55 ms
- 64 bytes from 192.168.118.201: icmp_seq=2 ttl=55 time=1.56 ms
- 64 bytes from 192.168.118.201: icmp_seq=3 ttl=55 time=1.68 ms
配置永久生效方法如下:
- 查看已配置的默认网关地址
- [root@SCTS-PC-DEV ~]# more /etc/sysconfig/network-scripts/ifcfg-enp3s0 | grep GATEWAY
- GATEWAY0=10.24.41.254
- [root@SCTS-PC-DEV ~]# nmcli connection show enp3s0 | grep GATEWAY
- IP4.GATEWAY: 10.24.41.254
- IP6.GATEWAY:
CentOS 6/7网卡重启命令回顾:
CentOS 6 以下用:service network restart
CentOS 7 以上用:systemctl restart network.service
CentOS 7查看网卡:systemctl status network.service 或 service network status
CentOS 7.3.1611网卡基本配置解析:
- [root@SCTS-PC-DEV ~]# more /etc/sysconfig/network-scripts/ifcfg-enp3s0
- TYPE=Ethernet
- BOOTPROTO=dhcp
- DEFROUTE=yes
- IPV4_FAILURE_FATAL=yes
- IPV6INIT=no
- IPV6_AUTOCONF=yes
- IPV6_DEFROUTE=yes
- IPV6_FAILURE_FATAL=no
- IPV6_ADDR_GEN_MODE=stable-privacy
- NAME=enp3s0
- UUID=ef3c0a14-5257-40c9-b166-2aa8ea9f2155
- DEVICE=enp3s0 #物理网卡名称
- ONBOOT=yes #开启自动启用网络连接设置开机启动
- GATEWAY0=10.24.41.254 #设置默认网关
- IPV6_PEERDNS=yes
- IPV6_PEERROUTES=yes
- PEERDNS=yes
- DNS1=202.102.152.3 #设置主DNS
- DNS2=202.102.128.68 #设置备DNS
- PEERROUTES=yes
案例三:centos下问题:connect:network is unreachable / 静态分配地址解决方法
http://www.cnblogs.com/valu/p/6515991.html
- 问题描述
- 弄了三台机器准备搭建一个集群,按照centos7系统,一台主节点安装桌面环境,两台计算节点。配置计算节点的时候,发现ping不通,出现connect:network is unreachable问题。
- 问题分析
- /etc/sysconfig/network-scripts/中只有ifcfg-lo文件,缺少ifcfg-eth0。
- 解决方案
- 方案一(临时)
- 使用命令ifconfig eth0 192.168.1.x可以正常设置eth0的IP,该方法仅为临时处理办法,系统重启后即失效了。
- 方案二(永久)
- 第一步:
- vim /etc/sysconfig/network-scripts/ifcfg-eth0
- 第二步,编辑:
- DEVICE=eth0 # 物理设备名称
- IPADDR=192.168.1.x #IP地址,需要设置
- NETMASK=255.255.255.0 #子网掩码
- GATEWAY=192.168.1.1 # 网关地址
- ONBOOT=yes #激活设备
- USERCTL=no #非ROOT用户不可以控制该设备
- BOOTPROTO=[none|static|bootp|dhcp]
- #引导时不使用协议|静态分配|BOOTP协议|dhcp协议,这里我选用的是静态分配,static。
- HWADDR=00:13:D3:27:9F:80 #MAC地址,通过ifconfig或者ip a获得
- NAME=eth0 #名称
- 第三步在文件/etc/rc.d/rc.local最后加入ifup eth0(/etc/rc.local脚本是在所有其它初始化脚本执行完毕后执行)。
- 第四步,reboot,重启电脑.
案例四:Centos7添加静态路由
http://www.cnblogs.com/panblack/p/Centos7_Static_Routes.html
[root@centos7 ~]# ip route add 10.15.150.0/ via 192.168.150.253 dev enp0s3
[root@centos7 ~]#
[root@centos7 ~]# ip route show|column -t
default via 192.168.150.254 dev enp0s3 proto static metric
10.15.150.0/ via 192.168.150.253 dev enp0s3 proto static metric
192.168.150.0/ dev enp0s3 proto kernel scope link src 192.168.150.110
[root@centos7 ~]#
[root@centos7 ~]# ping 10.15.150.1
PING 10.15.150.1 (10.15.150.1) () bytes of data.
bytes from 10.15.150.1: icmp_seq= ttl= time=1.77 ms
bytes from 10.15.150.1: icmp_seq= ttl= time=1.08 ms
bytes from 10.15.150.1: icmp_seq= ttl= time=1.57 ms
OS + CentOS 7.3.1611 / CentOS 救援模式 (rescue installed system)修复损坏系统
http://blog.csdn.net/yu132563/article/details/51308286
OS + CentOS 7.3.1611 / rc.local / 设置普通用户shell命令开启自动
linux 开机自动运行普通用户
http://blog.csdn.net/iamfafa/article/details/8782163
首先要必须先保证/etc/rc.d/rc.local对root具有可执行权限,默认redhat 6.3 /etc/rc.d/rc.local具有可执行权限。
[root@sctsdemo ~]# chmod +x /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 478 Aug 24 18:16 /etc/rc.d/rc.local

[root@sctsdemo ~]# vim /etc/rc.d/rc.local

远程真机Centos系统部署移动端TestRunner
一、 设置时间
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date -s "20180419 09:09:55"
//这里的时间设置为当前时间,按照这个格式date
--解决SDOSS上传文件或截图 403 forbidden的问题
二、 部署 libgconf-2.so.4文件动态库文件执行
解决过程:
(共62个安装包,是否不合理安装,未知,需要开发确认哪些必备基础依赖软件)
[root@CNHQ-SCTS-APP03 ~]# yum install gconf*
[root@CNHQ-SCTS-APP03 ~]# scp -r root@10.24.41.139:/usr/lib64/libgconf-2.so.4.1.5 /usr/lib64/
[root@CNHQ-SCTS-APP03 ~]# chmod 777 /usr/lib64/libgconf-2.so.4.1.5
[root@CNHQ-SCTS-APP03 ~]# whereis libgconf-2.so.4
libgconf-2.so: /usr/lib64/libgconf-2.so.4
[root@CNHQ-SCTS-APP03 ~]# reboot
执行成功如下:
[root@CNHQ-SCTS-APP03 ~]# /home/test/Downloads/TR_jdk1.8_Linux_prd180413/lib/autodependency/mobile/appium/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_64
Starting ChromeDriver 2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac) on port 9515
Only local connections are allowed.
/home/test/Downloads/android_sdk/build-tools/android-4.4.2/aapt
三、 问题二,无法执行aapt工具命令,依赖libc++.so
[root@CNHQ-SCTS-APP03 android-4.4.2]# /home/test/Downloads/android_sdk/build-tools/android-4.4.2/aapt
/home/test/Downloads/android_sdk/build-tools/android-4.4.2/aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory
解决过程
[root@CNHQ-SCTS-APP03 android-4.4.2]# locate libc++.so
/home/test/Downloads/TR_jdk1.8_Linux_prd180413/lib/autodependency/mobile/android_sdk/platform-tools/lib64/libc++.so
/var/lib/docker/overlay/1e76752ff2be6765c5ec246ab4a9d5830bbec28f511cc40c7fae881bd8740336/root/opt/platform-tools/lib64/libc++.so
/var/lib/docker/overlay/716314601f5c044408dd042fae020f871b017f17eec7fe5bc661d327579d8d82/root/opt/platform-tools/lib64/libc++.so
/var/lib/docker/overlay/7a10c108ef42562d45a441783c8c67206356f2ebb8d0a893a05c2e4cce58d5c0/root/opt/platform-tools/lib64/libc++.so
/var/lib/docker/overlay/b04de0dd2115be51f40eff0d815f752e1468ac2609498d94b8b44ef78c90b5f8/root/opt/platform-tools/lib64/libc++.so
/var/lib/docker/overlay/b5892a2326fe874fc80e9ef23b6a806b2fe7606eded58b7606f6fc5e3ede1a3b/root/opt/platform-tools/lib64/libc++.so
发现docker先人可能研究过,拷贝libc++.so到操作系统/usr/lib64/libc++.so重启使生效,appt命令可以执行了。如下:
[root@CNHQ-SCTS-APP03 android-4.4.2]cp /home/test/Downloads/TR_jdk1.8_Linux_prd180413/lib/autodependency/mobile/android_sdk/platform-tools/lib64/libc++.so /usr/lib64/libc++.so
执行成功如下:
[root@CNHQ-SCTS-APP03 android-4.4.2]# /home/test/Downloads/TR_jdk1.8_Linux_prd180413/lib/autodependency/mobile/android_sdk/build-tools/android-4.4.2/aapt
Android Asset Packaging Tool
Usage:
aapt l[ist] [-v] [-a] file.{zip,jar,apk}
List contents of Zip-compatible archive
四、 配置/android_sdk环境变量
先在Downloads目录拷贝一份android_sdk文件
vim /etc/profil
export ANDROID_HOME=/home/test/Downloads/android_sdk
export PATH=$ANDROID_HOME/build-tools:$PATH
source /etc/profile
end