systemctl enable
时间: 2023-10-16 19:06:59 浏览: 41
As an AI language model, I do not have the capability to execute commands as I am a text-based program. However, I can provide you with information about "systemctl enable."
"systemctl enable" is a command used in Linux systems to enable a specific service or unit so that it starts automatically on system startup. This command creates a symlink from the service file in the system's configuration directory to the systemd unit directory. Once enabled, the service will start automatically on system boot or when its dependencies become available.
For example, to enable the Apache web server service to start automatically on boot, you would run the command "systemctl enable httpd.service."
相关问题
systemctl enable sshd
这个命令是用来启动和停止系统服务的命令,`systemctl enable sshd`命令是用来开启在每次系统引导的时候自动启动sshd服务的命令。下面是具体步骤:
1. 开启ssh服务
在使用`systemctl enable sshd`命令之前,你需要确保已经安装了ssh服务。如果你的系统没有安装sshd服务,你需要使用以下命令安装:
```shell
sudo apt-get update
sudo apt-get install openssh-server
```
2. 启用sshd服务的自启动
输入以下命令来启用sshd自启动:
```shell
sudo systemctl enable sshd
```
3. 重启sshd服务
输入以下命令来重启sshd服务:
```shell
sudo systemctl restart sshd
```
这样sshd服务就已经开启并且已经设置自启动,你可以通过以下命令来检查服务是否已经开启:
```shell
sudo systemctl status sshd
```
systemctl enable mysqld
根据提供的引用内容,`systemctl enable mysqld`命令的作用是启用mysqld服务,使其在系统启动时自动启动。如果该服务未启用,则需要手动启动该服务。以下是启用mysqld服务的步骤:
1. 创建一个pid文件并修改权限
```shell
touch /var/run/mysql/mysqld.pid
chown mysql.mysql /var/run/mysql/mysqld.pid
```
2. 启用mysqld服务
```shell
systemctl enable mysqld
```
如果启用成功,将会输出以下信息:
```
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
```