菜单

澳门金沙国际CentOS 5.6安装LAMP(Apache2+PHP5+MySQL)

2019年2月3日 - 金沙编程资讯

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

CentOS7 安装 MariaDB

CentOS7以上版本上,不再行使MySQL数据库,而是使用玛丽亚DB数据库,其中玛丽亚DB是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 |
+——————–+
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.

#由于一开首设置玛丽亚DB数据库后, 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.

#是或不是删除test数据库
Remove test database and access to it? [Y/n] y

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里设置配置…

3 安装Apache2服务器

运转上面的指令:

yum install httpd

明天布署您的系统在开机时启动Apache…

systemctl enable httpd.service

与此同时启动Apache:

systemctl start httpd.service

在浏览器输入地方访问

澳门金沙国际 1

澳门金沙国际 2

Thanks for using MariaDB!

或许有不得法的地点,希望大家指正!

澳门金沙国际 3

Reloading the privilege tables will
ensure that all changes made so far
will take effect immediately.

LAMP网站服务器是Linux、
Apache、MySQL、PHP的简写。在Linux系统上设置apache服务器不是一件难事,因为大多主流的Linux发行版本软件库都囊括了要安装的软件,本文将向大家显示在Fedora
20序列上什么设置Apache2 web服务,PHP5 (mod_php)和 MySQL 数据库

近来在浏览器中输入

5.登陆数据库测试

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

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 ~]#

澳门金沙国际 4

Enter current password for root (enter
for none):
OK, successfully used password, moving
on…

1 安全前提示:

本文使用的主机名为:server1.example.com ,IP地址为 192.168.0.100。那一个必要依据你的主机意况作相应修改!

《?php
phpinfo();

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

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

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

澳门金沙国际 5

证实:在CentOS中Apache的默许根目录是/var/www/html,配置文件/etc/httpd/conf/httpd.conf。其余陈设存储在/etc/httpd/conf.d/目录。

五、安装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.数据库安全设置

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里面回运行,所以你需求把双引号改为单引号:

四、安装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的部分信息

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
总结机终端突显,按指示操作:

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

[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 ~]#

一、安装虚拟机

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

相关文章

发表评论

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

网站地图xml地图