20下安装搭建LAMP环境Apache,怎样搭建lamp

by admin on 2019年1月31日

自己在网上搜了诸多相关资料,然后自己开展了瞬间组合,把重复的消除,不重复的采纳性获取过滤,整合完了随后在该地虚拟机上尝试搭建了下,很顺遂的搭建成功。

CentOS7 安装 MariaDB

CentOS7以上版本上,不再使用MySQL数据库,而是利用玛丽亚DB数据库,其中MariaDB是MySQL的一个分支.现在写上个人在CentOS7里设置配备玛丽亚DB的手续:

  1. 下载安装玛丽亚DB

**yum -y install mariadb-server mariadb

  1. 启航玛丽亚DB,并设置root用户的密码:

#启动MariaDB服务
**

[[email protected]
/]# systemctl start mariadb

#设置玛丽亚DB开机默许启动
[[email protected]
/]# systemctl enable mariadb

ln -s ‘/usr/lib/systemd/system/mariadb.service’
‘/etc/systemd/system/multi-user.target.wants/mariadb.service’

#测试是还是不是中标启动
[[email protected]
/]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input
statement.

#查看默许安装了怎么数据库
MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
20下安装搭建LAMP环境Apache,怎样搭建lamp。+——————–+
4 rows in set (0.00 sec)

#退出
MariaDB [(none)]> exit
Bye

#在生产环境里安装完后,指出一定要运行两遍mysql_secure_installation安全安排向导
[[email protected]
/]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client:
command not found

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.

#鉴于一从头设置MariaDB数据库后, root用户默许密码为空,
所以只要求按Enter键
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.

#是还是不是设置root用户的新密码

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.

#是不是禁止root远程登录,根据自己的要求采用
Disallow root login remotely? [Y/n] n
… skipping.

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.

#20下安装搭建LAMP环境Apache,怎样搭建lamp。是不是删除test数据库
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!

#安然设置已毕后,测试使用root用户登录操作
[[email protected]
/]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input
statement.

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

安装 玛丽亚DB
CentOS7上述版本上,不再选择MySQL数据库,而是拔取玛丽亚DB数据库,其中玛丽亚DB是MySQL的一个分支.现在写上个体在CentOS7里设置配置…

LAMP网站服务器是Linux、
Apache、MySQL、PHP的简写。在Linux系统上安装apache服务器不是一件难事,因为几乎主流的Linux发行版本软件库都席卷了要安装的软件,本文将向大家浮现在Fedora
20体系上怎么着设置Apache2 web服务,PHP5 (mod_php)和 MySQL 数据库

LAMP是Linux+apache+MySQL+PHP的缩写。本课程演示怎么着设置在一台CentOS
5.6与PHP5(mod_php)和MySQL数据库加Apache2 web服务器。
1.开首证实
在本教程中选拔的主机名为server1.example.com,IP地址192.168.0.100。这么些设置可能与你的设置不相同,所以您不可以不在适合意况下更换。
2.安装MySQL 5.0
打开终端输入:
yum install mysql mysql-server
输入以下命令,让mysql数据库伴随系统活动启动:
chkconfig --levels 235 mysqld on/etc/init.d/mysqld start
设置MySQL的root帐户密码:
mysql_secure_installation
处理器终端彰显,按提醒操作:

虚拟机:win10系统自带的虚构机Hyper-v(虚拟机都几乎)

莫不有不正确的地点,希望大家指正!

[root@server1 ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, 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 MySQL
root user without the proper authorisation.

Set root password? [Y/n] <–
回车
New password: <– 你的root密码
Re-enter new password: <–
再输入四回root密码
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MySQL installation has an anonymous user, allowing
anyone
to log into MySQL 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] <–
回车
… 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] style=”COLOR: #ff0000″><– 回车
… Success!

By default, MySQL 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] style=”COLOR: #ff0000″> <– 回车

  • 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] style=”COLOR: #ff0000″><– 回车
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

[root@server1 ~]#

Linux系统:centos7

1 安全前提示:

本文使用的主机名为:server1.example.com ,IP地址为 192.168.0.100。那么些须要基于你的主机情状作相应修改!

3.安装Apache2
CentOS已经封装了apache2,使用直接在终极输入安装:
yum install httpd
安排体系并启动apache:
chkconfig --levels 235 httpd on
启动apache:
/etc/init.d/httpd start
现行浏览器输入IP地址,看看是或不是运行:

引进先在虚拟机中测试了随后,再在服务器上搭建环境。

2 安装数据库,有几个数据库可选:MySQL/玛丽亚DB 5

利用下边的通令安装MySQL:

yum install mysql mysql-server

为MySQL创设启动连接 (那样 MySQL 将随系统自动启动)并启动 MySQL服务:

systemctl enable mysqld.service

注意:假设你收到这么的不当

Failed to issue method call: No such file or directory

利用上边的授命

systemctl enable mariadb.service

更为启动mysql的劳务

systemctl start mysqld.service

运行

mysql_secure_installation

安装root用户密码(否则任何人都足以访问你MySQL数据库!):

[root@server1 ~]#
mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client:
command not found

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] <– (直接回车)
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] <– (直接回车)
… 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] <– (直接回车)
… 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] <– (直接回车)

  • 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] <– (直接回车)
… 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!
[root@server1 ~]#

bf88必发唯一官网 1

一、安装虚拟机

3 安装Apache2服务器

运转上边的一声令下:

yum install httpd

明天配备您的系统在开机时启动Apache…

systemctl enable httpd.service

再者启动Apache:

systemctl start httpd.service

在浏览器输入地方访问

bf88必发唯一官网 2

声明:在CentOS中Apache的默许根目录是/var/www/html,配置文件/etc/httpd/conf/httpd.conf。其余布署存储在/etc/httpd/conf.d/目录。

二、安装CentOS7

————————————–分割线

Ubuntu 13.04 安装
LAMP\Vsftpd\Webmin\phpMyAdmin 服务及安装

http://www.linuxidc.com/Linux/2013-06/86250.htm

CentOS
5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12)
http://www.linuxidc.com/Linux/2013-03/80333p3.htm

RedHat
5.4下Web服务器架设之源码营造LAMP环境及选择PHPWind
http://www.linuxidc.com/Linux/2012-10/72484p2.htm

LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHP
http://www.linuxidc.com/Linux/2013-05/84882.htm

LAMP+Xcache 环境搭建
http://www.linuxidc.com/Linux/2014-05/101087.htm

————————————–分割线
————————————– 

在Fedora系统中Apache默许根目录为 /var/www/html ,配置文件地方: /etc/httpd/conf/httpd.conf。其余安插文件目录
/etc/httpd/conf.d/。

越来越多详情见请继续阅读下一页的美丽内容
http://www.linuxidc.com/Linux/2014-05/101266p2.htm

bf88必发唯一官网 3

4.安装PHP5
安装PHP5和Apache PHP5模块如下命令:
yum install php
重复开动Apache
/etc/init.d/httpd restart
5.测试PHP5并拿走有关PHP5安装细节
在web服务器创制phpinfo文档:
vi /var/www/html/info.php
增进如下代码,因为那几个是函数,在wordpress里面回运行,所以您要求把双引号改为单引号:

注意:以下安装,我都是用的root权限。

《?php
phpinfo();

三、安装Apache
1.安装
yum -y install httpd
2.开启apache服务
systemctl start httpd.service
3.装置apache服务开机启动
systemctl enable httpd.service
4.验证apache劳动是还是不是安装成功
在本机浏览器中输入虚拟机的ip地址,如果看到apache默认的页面–有Testing
123…字样,便是马到功成安装了apache服务了。

近日在浏览器中输入

CentOS7查看ip地址的办法为:
ip addr
走访应该是没戏的,原因如下:
查了素材,说法是,CentOS7用的是Firewall-cmd,CentOS7从前用的是iptables防火墙;要想让外网能访问到apache主目录,就需求做以下的操作:
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
接下来再拜访外网ip,就足以了。

bf88必发唯一官网 4

四、安装PHP
1.安装
yum -y install php
2.重启apache服务
systemctl restart httpd或者systemctl restart httpd.service
接下来,你可以写一个php文件在浏览器中运行一下了;
eg:
vi /var/www/html/info.php
i
<?php phpinfo(); ?>
Esc
:wq
接下来,在大团结电脑浏览器输入 10.17.1.223/info.php
运行,会冒出php的局部新闻

倘使你见到如上截图,PHP5工作健康,继续向下滚动,看看你早已启动的PHP5模块。MySQL是从未有过列出,那代表大家有没有在PHP5中添加MySQL模块支持。

五、安装MySQL
安装MariaDB
1.安装
yum install mariadb mariadb-server mariadb-libs mariadb-devel
2.开启MySQL服务
systemctl start mariadb.service
3.设置开机启动MySQL服务
systemctl enable mariadb.service
4.数据库安全设置

bf88必发唯一官网 5

[root@localhost ~]#
mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT
IS RECOMMENDED FOR ALL MariaDB
bf88必发唯一官网, 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]
n

… skipping.

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!

5.登陆数据库测试

[root@localhost ~]# mysql -uroot
-p
Enter password:
Welcome to the MariaDB monitor. Commands
end with ; or \g.
Your MariaDB connection id is
11
Server version: 5.5.52-MariaDB MariaDB
Server

Copyright (c) 2000, 2016, Oracle,
MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type
‘\c’ to clear the current input statement.

MariaDB [(none)]> show
databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.02 sec)

MariaDB [(none)]>

六、将PHP和MySQL关联起来
``yum -y install php-mysql

七、安装常用的PHP模块
例如,GD库,curl,mbstring,…
1.安装:
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
2.重启apache服务
systemctl restart httpd.service
然后,再一次在浏览器中运作info.php,你会师到安装的模块的音讯;

从这之后,LAMP环境就搭建好了。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图