把ArchLinux装起来了。(其中用到了163.镜像源)
安装好之后,发现没有ssh服务。
1、需要安装ssh服务
1.1 pacman -Sy openssh --安装程序是pacman,不是 apt-get 或 yum
1.2 编辑 /etc/ssh/sshd_config,把#PermitRootLogin prohibit-password 改为 PermitRootLogin yes
1.3 启动服务 systemctl start sshd --用的服务管理程序 systemd服务来代替daemon
原本在/etc/init.d/目录下的启动文件,被/lib/systemd/system/下相应的文件所取代
daemon命令 systemctl命令 说明
service [服务] start systemctl start [unit type] 启动服务
service [服务] stop systemctl stop [unit type] 停止服务
service [服务] restart systemctl restart [unit type] 重启服务
设置开机启动/不启动
daemon命令 systemctl命令 说明
chkconfig [服务] on systemctl enable [unit type] 设置服务开机启动
chkconfig [服务] off systemctl disable [unit type] 设备服务禁止开机启动
systemctl命令 说明
systemctl 列出所有的系统服务
systemctl list-units 列出所有启动unit
systemctl list-unit-files 列出所有启动文件
systemctl list-units –type=service –all 列出所有service类型的unit
systemctl list-units –type=service –all grep cpu 列出 cpu电源管理机制的服务
systemctl list-units –type=target –all 列出所有target
systemctl命令 说明
systemctl is-active [unit type] 查看服务是否运行
systemctl is-enable [unit type] 查看服务是否设置为开机启动
systemctl mask [unit type] 注销指定服务
systemctl unmask [unit type] 取消注销指定服务
init命令 systemctl命令 说明
init 0 systemctl poweroff 系统关机
init 6 systemctl reboot 重新启动
systemctl命令 说明
systemctl suspend 进入睡眠模式
systemctl hibernate 进入休眠模式
systemctl rescue 强制进入救援模式
systemctl emergency 强制进入紧急救援模式
init级别 systemctl target
0 shutdown.target
1 emergency.target
2 rescure.target
3 multi-user.target
4 无
5 graphical.target
6 无
systemctl命令 说明
systemctl get-default 获得当前的运行级别
systemctl set-default multi-user.target 设置默认的运行级别为mulit-user
systemctl isolate multi-user.target 在不重启的情况下,切换到运行级别mulit-user下
systemctl isolate graphical.target 在不重启的情况下,切换到图形界面下