对这次实验进行总结,刚开始不知道那个配置文件要干嘛,因为机房电脑是安装和配置好的,当在自己电脑上面才发现原来不修改就启动不了。
用户名和密码的创建
1.新建一个用户名(lj200126是我自己的用户名)
[root@localhost ~]# useradd lj200126
2.给用户设置密码(输入密码的时候不会回显)
[root@localhost ~]# passwd lj200126
更改用户 lj200126 的密码 。
新的 密码:
无效的密码: 密码包含用户名在某些地方
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
3.是否有那个账号
[root@localhost ~]# cd /home/lj200126
[root@localhost lj200126]#
4.看一下是否能登录(root用户进入普通用户不需要输入密码)
[root@localhost 桌面]# su lj200126
[lj200126@localhost 桌面]$
5.回到root用户(用exit退回去不需要输入密码)
[lj200126@localhost 桌面]$ exit
exit
[root@localhost 桌面]#
[lj200126@localhost 桌面]$ su root
密码:
[root@localhost 桌面]#
DHCP服务的安装
1.用yum直接安装
yum install dhcp -y
2.编辑配置文件(这个用vi,vim也行)
[root@localhost lj200126]# gedit /etc/dhcp/dhcpd.conf
3.发现为空之后不要紧,我们复制一个过来(这里我出错比较多的地方就是文件是dhcpd.conf.example总是写成dhcp.conf.example,d总是忘记写,这下面是两个绝对路径,所以中间是有空格的,把前面路径下的文件拷贝到另一个路径下,最后一个dhcpd.conf是文件名)
[root@localhost lj200126]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
4.再次打开配置文件,发现里面有东西,那这个有什么用呢?
[root@localhost lj200126]# gedit /etc/dhcp/dhcpd.conf
5.直接启动dhcp服务
[root@localhost lj200126]# systemctl start dhcpd.service
Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journalctl -xe" for details.
6.发现启动失败了,所以这还是需要修改配置文件,打开配置文件前查看自己的ip,记录前面三个数字,我的是192.168.88。(没有报错直接跳转到第8步)
[root@localhost lj200126]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.88.130 netmask 255.255.255.0 broadcast 192.168.88.255
inet6 fe80::20c:29ff:fe8a:13e6 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:8a:13:e6 txqueuelen 1000 (Ethernet)
RX packets 22352 bytes 31745302 (30.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4804 bytes 299795 (292.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 8 bytes 1088 (1.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 1088 (1.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:12:94:c4 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
7.再次编辑配置文件,其他地方保持不变,画横线的地方修改成自己的ip前三位(我也不知道原理)(没有这部分的是正常情况,需要手动补上)
[root@localhost lj200126]# gedit /etc/dhcp/dhcpd.conf
8.保存,启动dhcp服务
[root@localhost lj200126]# systemctl start dhcpd.service
[root@localhost lj200126]# netstat -antup|grep dhcp
udp 0 0 0.0.0.0:67 0.0.0.0:* 3274/dhcpd
参考链接:
【Linux】DHCP服务器启动报错Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journalctl -xe" for details. – 万万没想到 (wanpeng.life)https://www.wanpeng.life/1492.html说明:机房电脑的dhcp应该是已经配置了,可以直接启动。
命名的保存
1.切换成拼音输入
2.从桌面进入,到时候文件夹就在桌面了。
[root@localhost 桌面]# history > 实验1.txt
[root@localhost 桌面]#
history没有参数就是查看所以的命令记录了。
希望能够帮助到大家。