Centos7.2环境准备_配置本地yum源 关闭firewalld和selinux

一、配置本地yum源

查看yum源目录

[root@centos01 ~]# ll /etc/yum.repos.d/
总用量 28
-rw-r--r--. 1 root root 1664 12月 9 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 12月 9 2015 CentOS-CR.repo
-rw-r--r--. 1 root root 649 12月 9 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 290 12月 9 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 12月 9 2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 12月 9 2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 12月 9 2015 CentOS-Vault.repo

移除自带yum源

[root@centos01 ~]# mv /etc/yum.repos.d/* /tmp

创建挂载目录

[root@centos01 etc]# mkdir /mnt/cdrom

设置开机自动挂载

[root@centos01 etc]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Mar 20 21:34:44 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=1def7626-55d2-4d85-b2b1-2d82ae268045 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 defaults 0 0    #设置开机挂载iso镜像文件

以只读方式挂载

[root@centos01 etc]# mount -a
mount: /dev/sr0 写保护,将以只读方式挂载

查看挂载目录

[root@centos01 etc]# ll /mnt/cdrom/
总用量 636
-r--r--r--. 1 root root 14 12月 10 2015 CentOS_BuildTag
dr-xr-xr-x. 3 root root 2048 12月 10 2015 EFI
-r--r--r--. 1 root root 215 12月 10 2015 EULA
-r--r--r--. 1 root root 18009 12月 10 2015 GPL
dr-xr-xr-x. 3 root root 2048 12月 10 2015 images
dr-xr-xr-x. 2 root root 2048 12月 10 2015 isolinux
dr-xr-xr-x. 2 root root 2048 12月 10 2015 LiveOS
dr-xr-xr-x. 2 root root 612352 12月 10 2015 Packages
dr-xr-xr-x. 2 root root 4096 12月 10 2015 repodata
-r--r--r--. 1 root root 1690 12月 10 2015 RPM-GPG-KEY-CentOS-7
-r--r--r--. 1 root root 1690 12月 10 2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r--. 1 root root 2883 12月 10 2015 TRANS.TBL

创建新yum源

[root@centos01 etc]# cd /etc/yum.repos.d/
[root@centos01 yum.repos.d]# vi ops.repo
[cdrom]
name=local-vcd
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0

清除缓存

[root@centos01 yum.repos.d]# yum clean all
已加载插件:fastestmirror
正在清理软件源: cdrom
Cleaning up everything

查看yum源

[root@centos01 yum.repos.d]# yum repolist
已加载插件:fastestmirror
cdrom | 3.6 kB 00:00:00 
(1/2): cdrom/group_gz | 155 kB 00:00:00 
(2/2): cdrom/primary_db | 2.8 MB 00:00:00 
Determining fastest mirrors
源标识 源名称 状态
cdrom local-vcd 3,723
repolist: 3,723

建立缓存

[root@centos01 yum.repos.d]# yum makecache
已加载插件:fastestmirror
cdrom | 3.6 kB 00:00:00 
(1/2): cdrom/other_db | 1.2 MB 00:00:00 
(2/2): cdrom/filelists_db | 2.9 MB 00:00:00 
Loading mirror speeds from cached hostfile
元数据缓存已建立

安装常用软件

[root@centos01 yum.repos.d]# yum install wget net-tools vim lrzsz tree screen lsof tcpdump -y

关闭firewalld

[root@centos01 ~]# systemctl stop firewalld
[root@centos01 ~]# systemctl disable firewalld 

关闭Network Manager(网络管理工具)

[root@centos01 ~]# systemctl stop NetworkManager
[root@centos01 ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service. 

关闭selinux

[root@centos01 ~]# vi /etc/selinux/config
SELINUX=disabled