启动Amazon EC2实例时如何自动启动Web服务? [英] How to auto start web services when starting an Amazon EC2 instance?
问题描述
如何设置 httpd 和< a href = / questions / tagged / mysqld class = post-tag title =显示已标记'mysqld' rel = tag> mysqld 服务的问题,这些服务会在启动 amazon-ec2 实例?
How do I set the httpd and mysqld services to start automatically upon booting an amazon-ec2 instance?
当前,我必须通过ssh连接到实例并运行 sudo服务httpd start
和 sudo来手动启动它们服务mysqld start
。
Currently I have to start them manually by connecting to the instance via ssh and running sudo service httpd start
and sudo service mysqld start
.
推荐答案
与其重新开始一个新的AMI,不如开始在Amazon Linux EC2实例上执行以下命令...
Rather than starting over with a new AMI, you could just issue the following commands on an Amazon Linux EC2 instance...
sudo chkconfig mysqld on
sudo chkconfig httpd on
您可以在&使用以下命令启用这些服务以在启动时启动后...
You can check the settings before & after enabling these services to start on boot using the following commands...
sudo chkconfig --list mysqld
sudo chkconfig --list httpd
仅使用...查看所有服务...
See all services using just...
sudo chkconfig --list
注意:如果chkconfig在root的路径中遇到任何麻烦,您可以尝试指定像这样的完整路径...
sudo /sbin/chkconfig mysqld on
sudo /sbin/chkconfig httpd on
这篇关于启动Amazon EC2实例时如何自动启动Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!