版权声明: https://blog.csdn.net/zhydream77/article/details/81148635
脚本如下:
[root@localhost shell]# vim lnmp.sh
#!/bin/bash
yum -y install httpd ----安装http
yum -y install mariadb mariadb-devel mariadb-server ---安装数据库
yum -y install php php-mysql ----安装php依赖包
systemctl start httpd ------开启http服务
systemctl enable httpd ------设置自动开启httpd服务
systemctl status httpd -----查看http的服务状态
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
执行脚本的效果图(在运行的时候确保yum中有相关的包)
[root@localhost shell]# sh lnmp.sh
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
软件包 httpd-2.4.6-67.el7.x86_64 已安装并且是最新版本
无须任何处理
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
软件包 1:mariadb-5.5.56-2.el7.x86_64 已安装并且是最新版本
软件包 1:mariadb-devel-5.5.56-2.el7.x86_64 已安装并且是最新版本
软件包 1:mariadb-server-5.5.56-2.el7.x86_64 已安装并且是最新版本
无须任何处理
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
软件包 php-5.4.16-42.el7.x86_64 已安装并且是最新版本
软件包 php-mysql-5.4.16-42.el7.x86_64 已安装并且是最新版本
无须任何处理
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since 六 2018-07-21 20:16:27 CST; 125ms ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 7865 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─7865 /usr/sbin/httpd -DFOREGROUND
├─7867 /usr/sbin/httpd -DFOREGROUND
├─7868 /usr/sbin/httpd -DFOREGROUND
├─7869 /usr/sbin/httpd -DFOREGROUND
├─7870 /usr/sbin/httpd -DFOREGROUND
└─7871 /usr/sbin/httpd -DFOREGROUND
7月 21 20:16:27 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
7月 21 20:16:27 localhost.localdomain httpd[7865]: AH00558: httpd: Could not reliably determine the server's fully q...ssage
7月 21 20:16:27 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since 六 2018-07-21 20:16:33 CST; 121ms ago
Main PID: 7978 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─7978 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─8140 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-e...
7月 21 20:16:30 localhost.localdomain mariadb-prepare-db-dir[7900]: MySQL manual for more instructions.
7月 21 20:16:30 localhost.localdomain mariadb-prepare-db-dir[7900]: Please report any problems at http://mariadb.org/jira
7月 21 20:16:30 localhost.localdomain mariadb-prepare-db-dir[7900]: The latest information about MariaDB is available ...g/.
7月 21 20:16:30 localhost.localdomain mariadb-prepare-db-dir[7900]: You can find additional information about the MySQ...at:
7月 21 20:16:30 localhost.localdomain mariadb-prepare-db-dir[7900]: http://dev.mysql.com
7月 21 20:16:30 localhost.localdomain mariadb-prepare-db-dir[7900]: Consider joining MariaDB's strong and vibrant community:
7月 21 20:16:30 localhost.localdomain mariadb-prepare-db-dir[7900]: https://mariadb.org/get-involved/
7月 21 20:16:30 localhost.localdomain mysqld_safe[7978]: 180721 20:16:30 mysqld_safe Logging to '/var/log/mariadb/mar...og'.
7月 21 20:16:30 localhost.localdomain mysqld_safe[7978]: 180721 20:16:30 mysqld_safe Starting mysqld daemon with data...ysql
7月 21 20:16:33 localhost.localdomain systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.
---------------------
作者:zhy-dream
来源:CSDN
原文:https://blog.csdn.net/zhydream77/article/details/81148635
版权声明:本文为博主原创文章,转载请附上博文链接!