`

linux 系统快速安装lamp

阅读更多

Step 2. 安装php/mysql/httpd
#安装apache 
yum -y install httpd httpd-devel  
#安装mysql 
yum -y install mysql mysql-devel mysql-server mysql-libs 

phpMyAdmin]# yum -y install httpd-man l mod_ssl mod_perl mod_auth_mysql

#安装php 
yum -y install php 
#安装php扩展 
yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-mbstring php-devel php-soap php-cli php-pdo  
yum -y install php-mcrypt php-tidy php-xml php-xmlrpc php-pear   
#其它不常用php扩展, www.linuxidc.com 可不用安装 
yum -y install php-pecl-memcache php-eaccelerator 
#安装phpmyadmin 
yum -y install phpmyadmin  
#安装完成之后,启动 
service httpd start 
service mysqld start 

2、为root账户设置密码
mysql_secure_installation
回车,根据提示输入Y
输入2次密码,回车
根据提示一路输入Y
最后出现:Thanks for using MySQL!

[root@iZ25tti3rxdZ ~]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h iZ25tti3rxdZ password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@iZ25tti3rxdZ ~]# 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):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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] y
New password:
Re-enter new password:
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] n
 ... skipping.

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, 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] 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 MySQL
installation should now be secure.

Thanks for using MySQL!

 
MySql密码设置完成,重新启动 MySQL:
/etc/init.d/mysqld restart #重启
/etc/init.d/mysqld stop #停止
/etc/init.d/mysqld start #启动

 

 

Step 3.配置httpd、mysqld开机自启动
chkconfig mysqld on 
chkconfig httpd on 

Step 4.配置phpmyadmin
修改/usr/share/phpmyadmin/config.inc.php或者 /usr/share/phpMyAdmin/config.inc.php
#将这里abcde文字修改为自己的字符,可任意
$cfg['blowfish_secret'] = 'abcde'; 

常见问题
1. phpmyadmin提示未开启php-mcrypt,这是因为没有安装php-mrcrpt扩展。在官方源没有php-mrcrpt扩展,请安装epel源后再yum install php-mcrypt

2. phpmyadmin无法访问

phpmyadmin默认只能使用http://localhost/phpmyadmin来访问,可以修改/etc/httpd/conf.d/phpmyadmin.conf中对应部分为
<Directory "/usr/share/phpmyadmin"> 
  Order Deny,Allow 
#  Deny from all 
  Allow from All 
</Directory> 
不过强烈不支持这么做的,把phpmyadmin暴露了不安全

注意:
apache解析php,修改httpd.conf文件,添加
Addtype application/x-httpd-php .php .phtml
Addtype application/x-httpd-php-source .phps

myql可以远程登录
设置mysql密码
mysql>; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql>; FLUSH PRIVILEGES;
1.2.3 允许远程登录
mysql -u root -p
Enter Password: <your new password>
mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
完成后就能用mysql-front远程管理mysql了。
设为开机启动
chkconfig mysqld on

 

我执行过程:

[root@huangwei mysql]# mysql_secure_installation
/bin/mysql_secure_installation:行379: find_mysql_client: 未找到命令

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):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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] n
 ... skipping.

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!

 

 

 

 

参考:

http://www.jb51.net/article/38601.htm

 

分享到:
评论

相关推荐

    华为工程师总结Linux笔记.pdf

    第 2 章 Linux 发展及系统安装 15 第 3 章 CentOS 系统管理 42 第 4 章 Linux 必备命令 72 第 5 章 Linux 用户及权限管理 93 第 6 章 Linux 软件包企业实战 108 第 7 章 Linux 文件服务器企业实战 145 第 8 章 ...

    lanmp v2.5一键安装包(包括lamp,lnmp,lnamp安装)

    1 支持lamp(linux+apache+php+mysql),lnmp(linux+nginx+php+mysql)环境快速安装部署上线 2 支持lnamp,即支持nginx+apache组合环境的应用,也即是nginx前端处理静态,图片等,apche处理后台php脚本程序。nginx在处理...

    华为工程师linux的笔记-第5章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第2章 .pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    Lamp架构介绍

    LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网络服务器,MySQL数据库,Perl、PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,...

    LAMP网站架构方案分析.doc

    针对流行的LAMP作一些分析,AMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网络服务器,MySQL数据库,Perl、PHP或者Python编程语言,所有组成产品均是开源软件...

    华为工程师linux的笔记-第6章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第7章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第8章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第9章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第10章 .pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第11章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux笔记-第1章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第4章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第3章 .pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第12章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第13章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    华为工程师linux的笔记-第14章.pdf

    Linux基础篇总共包含8个章节,第1章到第8章学习内容分别包括:Linux快速入门、Linux发展及系统安装、CentOS Linux系统管理、Linux必备命令、Linux用户和组、Linux软件包管理、磁盘管理、Linux文件共享管理等。...

    LAMP配置手册

    Linux+apace+MYSQL+PHP

    CentOS VPS安装Kloxo免费虚拟主机管理系统

    Kloxo简介 Kloxo的前身是lxadmin,是一款免费的虚拟主机管理系统,安装简单,功能强大,可以快速地在red hat,centos系列linux系统的主机上搭建LAMP(Linux+Apache+Mysql+Perl/PHP/Python)环境。 安装kloxo Kloxo...

Global site tag (gtag.js) - Google Analytics