通常:LAMP=Linux+Apache+MySQL+PHP
- LAMP即指向Linux(操作系统)、ApacheHTTP web服务器,MySQL(MariaDB,数据库软件) 和PHP(通常为Perl或Python) 的首字母,一般我们用来建立web应用平台;在即一个火爆的AMP架构。
yum安装命令:
yum -y install httpd mariadb mariadb-server mariadb-devel php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
到这里已经安装成功!
Apache启动和设置开机启动测试PHP页面;
systemctl start httpd
systemctl enable httpd
测试PHP:(在Apache发布目录新建index.php)
vim /var/www/html/index.php
重启Apache:(浏览器输入IP访问)
systemctl start httpd
设置MariaDB数据库启动和开机启动;
systemctl start mariadb
systemctl enable mariadb
可用netstat -ntl或其它ps命令查看服务是否启动;
netstat -ntlp
设置数据库安全:(数据库安全和前面文章编译一样可查看http://www.mxsina.com/srcmysql5-5/)
这里我们直接输入命令:
mysql_secure_installation
这里设置完密码后可一路y下来;
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
使用命令登录下mysql;
mysql -uroot -p(这里也可以接密码处于安全不介意)
至此一个极速简单LAMP搭建完事。
本文作者为SKY RING,转载请注明。
声明一下,此教程仅适用centos7以上的版本!
@菜鸟博客忽略了[aru_25]多谢多谢我得改改了,不然坑人啊这
@Azura还要配合防火墙呢!
@菜鸟博客云上突然意识到它的重要性了[aru_6]