目录
- [root@wenjian ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
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=ens33
UUID=1453936c-357b-47bb-8ab1-6e93a53060b6
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.73.28 //改为自己的IP地址
PREFIX=24
GATEWAY=192.168.73.2
2、[root@wenjian ~]# systemctl restart network //重启网络
- 配ip地址
- 设置光驱DVD模式
- [root@wenjian ~]# mkdir /cdrom
- [root@wenjian ~]# mount /dev/cdrom /cdrom/
- [root@wenjian ~]# vi /etc/yum.repos.d/CentOS-Base.repo //修改为如下内容
[base]
name=CentOS-$releasever - Base
baseurl=file:///cdrom
gpgcheck=0
enable=1
6、[root@wenjian ~]# yum -y install nfs-utils //安装nfs命令
1、第一台机:
- 配ip地址
- 设置光驱DVD模式
- [root@wenjian ~]# mkdir /cdrom
- [root@wenjian ~]# mount /dev/cdrom /cdrom/
- [root@wenjian ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///cdrom
file:///cdrom/Packages
gpgcheck=0
enable=1
- [root@wenjian ~]# yum -y install nfs-utils
- [root@wenjian ~]# mkdir /fs1
- [root@wenjian ~]# vi /etc/exports
/fs1 *(rw,sync)
- [root@wenjian ~]# systemctl restart nfs
- [root@wenjian ~]# showmount -e 192.168.73.27
显示:Export list for 192.168.73.27:
/fs1 *
- [root@wenjian ~]# systemctl stop firewalld
2、第二台机:
- 配ip地址
- 设置光驱DVD模式
- [root@wenjian ~]# mkdir /cdrom
- [root@wenjian ~]# mount /dev/cdrom /cdrom/
- [root@wenjian ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///cdrom
file:///cdrom/Packages
gpgcheck=0
enable=1
- [root@wenjian ~]# yum -y install nfs-utils
- [root@wenjian ~]# systemctl stop firewalld
- [root@wenjian ~]# mkdir /n1
- [root@wenjian ~]# showmount -e ip地址
- [root@wenjian ~]# mount ip地址:/fs1 /n1
- [root@wenjian ~]# df //(查看)
- 配ip地址
- 设置光驱DVD模式
- [root@wenjian ~]# mkdir /cdrom
- [root@wenjian ~]# mount /dev/cdrom /cdrom/
- [root@wenjian ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///cdrom
gpgcheck=0
enable=1
- [root@wenjian ~]# yum -y install nfs-utils
- [root@wenjian ~]# yum -y install samba
// 建立共享目录,并建立测试文件
- [root@wenjian ~]# mkdir /who(创建目录)
- [root@wenjian ~]# mkdir /who/yu(创建目录)
- [root@wenjian ~]# touch /who/yu/test_share.tar(创建文件)
// 添加用户,添加相应的Samba用户
- [root@wenjian ~]# groupadd yu(建立yu组)
- [root@wenjian ~]# useradd -g yu yu1(建立yu1用户,添加到yu)
- [root@wenjian ~]# useradd -g yu yu2
- [root@wenjian ~]# useradd test_user1
- [root@wenjian ~]# passwd yu1(设置yu1的密码)
- [root@wenjian ~]# passwd yu2
- [root@wenjian ~]# passwd test_user1
// 为成员添加相应的Samba账户
- [root@wenjian ~]# smbpasswd -a yu1
- [root@wenjian ~]# smbpasswd -a yu2
// 修改主配置文件
- [root@wenjian ~]# vi /etc/samba/smb.conf
[yu]
comment = yu
path = /who/yu
writable = yes
browseable = yes
valid users = @yu
// 设置共享目录的本地系统权限
- [root@wenjian ~]# chmod 777 /who/yu -R
- [root@wenjian ~]# chown yu1:yu /who/yu -R
- [root@wenjian ~]# chown yu2:yu /who/yu -R
// 更改共享目录的context值
- [root@wenjian ~]# chcon -t samba_share_t /who/yu -R
// 让防火墙放行
- [root@wenjian ~]# firewall-cmd --permanent --add-service=samba
- [root@wenjian ~]# firewall-cmd –reload(重新加载防火墙)
- [root@wenjian ~]# firewall-cmd --list-all
- [root@wenjian ~]# systemctl restart smb(重新加载samba)
- 打开此电脑,在“映射网络驱动器”对话框选择Z驱动器,并输入tech共享目录的地址,如:\\192.168.73.27\yu。
- 配ip地址
- 设置光驱DVD模式
- [root@wenjian ~]# mkdir /cdrom
- [root@wenjian ~]# mount /dev/cdrom /cdrom/
- [root@wenjian ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///cdrom
gpgcheck=0
enable=1
- [root@wenjian ~]# yum -y install nfs-utils
- [root@wenjian ~]# yum -y install dhcp
- [root@wenjian ~]# cat /etc/dhcp/dhcpd.conf
- [root@wenjian ~]# cp/usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
- [root@wenjian ~]# vi /etc/dhcp/dhcpd.conf
subnet 192.168.73.0 netmask 255.255.255.0 {
range 192.168.73.20 192.168.73.30;
option domain-name-servers 192.168.73.2;
option domain-name "internal.example.org";
option routers 192.168.73.2;
option broadcast-address 192.168.73.2;
default-lease-time 600;
max-lease-time 7200;
- [root@wenjian ~]# systemctl restart dhcpd
- [root@wenjian ~]# systemctl enable dhcpd