简体   繁体   中英

Ubuntu Amazon Web Service LAMP stack setup

I am trying to set up a LAMP stack on my Amazon Web Service AMI, which is an Ubuntu System.

I went through this tutorial: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html

The only difference which I made is installing php 7.

I stuck at this Point: Start the MySQL server.

[ec2-user ~]$ sudo service mysqld start

Currently it Returns this error:

mysqld: unrecognized Service

Same for These commands:

[ec2-user ~]$ sudo service mysql start
[ec2-user ~]$ sudo service mysqlnd start

If I run php -i | grep mysqlnd php -i | grep mysqlnd I get following Output:

/etc/php-7.0.d/20-mysqlnd.ini, Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $ mysqlnd mysqlnd => enabled Version => mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $ Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_sha256_password mysqlnd statistics => Client API version => mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $

On Ubuntu 16.04, the command would be:

sudo service mysql start

It looks like the MySQL server might not be installed. You can install the MySQL server and client tools with:

sudo apt-get install mysql-server

You will be asked to create a password for the MySQL root user during installation.

The tutorial you link to is for Amazon Linux, which (amongst other differences) uses a different package manager than Ubuntu to install and manage software. In the tutorial, the line sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd would have installed the mysql56-server package alongside apache and php.

If you need a web server quickly without have to worry about setup you may as well launch an instance picked from the AWS Marketplace. There are perfect Amazon Machine Images (AMI) for any situation.

For instance, Bitnami offers LAMP solutions on AWS Marketplace with no extra cost besides EC2 pricing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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