简体   繁体   English

全新安装:httpd.service:未找到单元

[英]Fresh install: httpd.service: Unit not found

Currently I'm trying to follow this guide: https://marxtudor.com/how-to-install-wordpress-using-ssh-on-centos-vps/目前我正在尝试遵循本指南: https ://marxtudor.com/how-to-install-wordpress-using-ssh-on-centos-vps/

I'm using Google Cloud Platform (free edition to test) and I've created a fresh CentOS 7 VM.我正在使用 Google Cloud Platform(免费版进行测试)并且我创建了一个新的 CentOS 7 VM。 The guide above are the first commands I fill in and I keep getting this error:上面的指南是我填写的第一个命令,我不断收到此错误:

I've followed so many tutorials, created a new VM and all the time I bump into this error that it doesn't know the httpd command.. I even deleted the project and started all over, but still no luck.我已经学习了很多教程,创建了一个新的虚拟机,并且一直遇到这个错误,它不知道 httpd 命令。我什至删除了项目并重新开始,但仍然没有运气。

[rsa-key-XXXXXX]$ sudo service httpd restart

Redirecting to /bin/systemctl restart httpd.service

Failed to restart httpd.service: Unit not found.


[rsa-key-XXXXXX]$ httpd -t

-bash: httpd: command not found

[rsa-key-XXXXXX]$

Could anyone please let me know what could be causing this ?任何人都可以让我知道可能导致这种情况的原因吗?

Thanks in advance!提前致谢!

I was also getting the same error, this is how i resolved my issue. 我也遇到了同样的错误,这就是我解决问题的方式。

After logging to the machine: 登录到计算机后:

  • Step 1: Become the root user. 步骤1:成为root用户。 command: sudo su 命令:sudo su
  • Step 2: Update Kernal command: yum update -y 步骤2:Update Kernal命令:yum update -y
  • Step 3: Install Apache command: yum install httpd -y 步骤3:安装Apache命令:yum install httpd -y
  • Step 4: Start Apache command: service httpd start 步骤4:启动Apache命令:service httpd start
  • Step 5: Check Status of Service command: service httpd status 步骤5:检查服务状态命令:服务httpd状态

This should solve your problem. 这应该可以解决您的问题。 good luck 祝好运

Do you want to install WordPress for your Compute Engine VM instance, using CentOS 7? 您是否要使用CentOS 7为Compute Engine VM实例安装WordPress?

If this is the case, you may do so by setting up LAMP for your VM, as described here [1], and then download the WordPress release of your choice [2] and install it on your VM. 如果是这种情况,您可以按照此处[1]的说明为VM设置LAMP,然后下载您选择的WordPress版本[2]并将其安装在VM上。

I understand that you have successfully set up a VM instance using Centos 7, is this correct? 我了解您已经使用Centos 7成功设置了VM实例,对吗? Assuming this, and as you may see from [1], for CentOS 7, these would be the commands to perform this installation: 假设您可以从[1]中看到,对于CentOS 7,这些将是执行此安装的命令:

1) Update and install Apache and PHP: 1)更新并安装Apache和PHP:

sudo yum check-update
sudo yum -y install httpd php

2) Start the Apache service: 2)启动Apache服务:

sudo service httpd start

sudo chkconfig httpd on

3) Install, configure and start DB: 3)安装,配置和启动数据库:

sudo yum -y install httpd mariadb-server php php-mysql
sudo systemctl start mariadb

4) Configure MySQL (set a password for the root user if you want): 4)配置MySQL(如果需要,请为root用户设置密码):

sudo mysql_secure_installation

5) Restart Apache sudo service httpd restart 5)重启Apache sudo服务httpd重启

Once MySQL is set up, you will have to create a database for your WordPress installation. 设置完MySQL之后,您将必须为WordPress安装创建一个数据库。

Following this procedure, you will have Apache, MySQL and PHP installed and running on your Compute Engine VM instance. 按照此步骤,您将在Compute Engine VM实例上安装并运行Apache,MySQL和PHP。

Then, you can download the WordPress release of your choice [2], unzip the file and install WordPress by visiting your IP address and the folder where WordPress was downloaded. 然后,您可以下载您选择的WordPress版本[2],解压缩文件并通过访问您的IP地址和WordPress的下载文件夹来安装WordPress。 For example, http://YOUR_PUBLIC_VM_IP_ADDRESS/wordpress . 例如, http:// YOUR_PUBLIC_VM_IP_ADDRESS / wordpress

You will be asked for a database name, the user and password. 系统将要求您输入数据库名称,用户名和密码。 This will allow WordPress to create the wp-config.php file on your behalf and proceed with the installation. 这将允许WordPress代表您创建wp-config.php文件并继续安装。

At this point, you should have WordPress already installed on your Compute Engine VM instance using CentOS 7. 此时,您应该已经使用CentOS 7在您的Compute Engine VM实例上安装了WordPress。

An easier way to install WordPress on Compute Engine VM instances, would be by using the Marketpĺace in the Cloud Platform Console. 在Compute Engine VM实例上安装WordPress的更简单方法是使用Cloud Platform Console中的Marketpace。 Go to your Products and Services menu > Marketplace, and search for "Wordpress". 转到“产品和服务”菜单>“市场”,然后搜索“ Wordpress”。 You will be presented with many different options to launch WordPress in a Compute Engine VM instance. 您将看到许多不同的选项,以在Compute Engine VM实例中启动WordPress。 Nevertheless, it seems that Debian is the deafult OS used for these options. 但是,似乎Debian是用于这些选项的默认操作系统。


Links: 链接:

[1] https://cloud.google.com/community/tutorials/setting-up-lamp [1] https://cloud.google.com/community/tutorials/setting-up-lamp

[2] https://wordpress.org/download/ [2] https://wordpress.org/download/

Fabian Garcia's solution still works. Fabian Garcia 的解决方案仍然有效。 I just stumbled on this, remembered having these errors.我只是偶然发现了这一点,记得有这些错误。 chkconfig on resolves failed to start http.service: unit not found chkconfig on resolves failed to start http.service: unit not found

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM