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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM