linux 系统快速安装lamp

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介:

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!

Java代码   收藏代码
  1. [root@iZ25tti3rxdZ ~]# service mysqld start  
  2. Initializing MySQL database:  Installing MySQL system tables...  
  3. OK  
  4. Filling help tables...  
  5. OK  
  6.   
  7. To start mysqld at boot time you have to copy  
  8. support-files/mysql.server to the right place for your system  
  9.   
  10. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !  
  11. To do so, start the server, then issue the following commands:  
  12.   
  13. /usr/bin/mysqladmin -u root password 'new-password'  
  14. /usr/bin/mysqladmin -u root -h iZ25tti3rxdZ password 'new-password'  
  15.   
  16. Alternatively you can run:  
  17. /usr/bin/mysql_secure_installation  
  18.   
  19. which will also give you the option of removing the test  
  20. databases and anonymous user created by default.  This is  
  21. strongly recommended for production servers.  
  22.   
  23. See the manual for more instructions.  
  24.   
  25. You can start the MySQL daemon with:  
  26. cd /usr ; /usr/bin/mysqld_safe &  
  27.   
  28. You can test the MySQL daemon with mysql-test-run.pl  
  29. cd /usr/mysql-test ; perl mysql-test-run.pl  
  30.   
  31. Please report any problems with the /usr/bin/mysqlbug script!  
  32.   
  33.                                                            [  OK  ]  
  34. Starting mysqld:                                           [  OK  ]  
  35. [root@iZ25tti3rxdZ ~]# mysql_secure_installation  
  36.   
  37.   
  38.   
  39.   
  40. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL  
  41.       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!  
  42.   
  43.   
  44. In order to log into MySQL to secure it, we'll need the current  
  45. password for the root user.  If you've just installed MySQL, and  
  46. you haven't set the root password yet, the password will be blank,  
  47. so you should just press enter here.  
  48.   
  49. Enter current password for root (enter for none):  
  50. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)  
  51. Enter current password for root (enter for none):  
  52. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)  
  53. Enter current password for root (enter for none):  
  54. OK, successfully used password, moving on...  
  55.   
  56. Setting the root password ensures that nobody can log into the MySQL  
  57. root user without the proper authorisation.  
  58.   
  59. Set root password? [Y/n] y  
  60. New password:  
  61. Re-enter new password:  
  62. Password updated successfully!  
  63. Reloading privilege tables..  
  64.  ... Success!  
  65.   
  66.   
  67. By default, a MySQL installation has an anonymous user, allowing anyone  
  68. to log into MySQL without having to have a user account created for  
  69. them.  This is intended only for testing, and to make the installation  
  70. go a bit smoother.  You should remove them before moving into a  
  71. production environment.  
  72.   
  73. Remove anonymous users? [Y/n] n  
  74.  ... skipping.  
  75.   
  76. Normally, root should only be allowed to connect from 'localhost'.  This  
  77. ensures that someone cannot guess at the root password from the network.  
  78.   
  79. Disallow root login remotely? [Y/n] n  
  80.  ... skipping.  
  81.   
  82. By default, MySQL comes with a database named 'test' that anyone can  
  83. access.  This is also intended only for testing, and should be removed  
  84. before moving into a production environment.  
  85.   
  86. Remove test database and access to it? [Y/n] y  
  87.  - Dropping test database...  
  88.  ... Success!  
  89.  - Removing privileges on test database...  
  90.  ... Success!  
  91.   
  92. Reloading the privilege tables will ensure that all changes made so far  
  93. will take effect immediately.  
  94.   
  95. Reload privilege tables now? [Y/n] y  
  96.  ... Success!  
  97.   
  98. Cleaning up...  
  99.   
  100.   
  101.   
  102. All done!  If you've completed all of the above steps, your MySQL  
  103. installation should now be secure.  
  104.   
  105. 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

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
18天前
|
Linux
Linux系统之whereis命令的基本使用
Linux系统之whereis命令的基本使用
54 23
Linux系统之whereis命令的基本使用
|
5天前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
54 25
|
21天前
|
Ubuntu Java Linux
Linux 安装 Qualcomm ® SnapdragonTM Profiler
通过本文的详细介绍,您应该已经成功在 Linux 系统上安装并配置了 Qualcomm® Snapdragon™ Profiler,并能够连接 Android 设备进行性能分析。Snapdragon Profiler 提供了丰富的工具和功能,可以帮助开发者深入了解应用程序的性能瓶颈,从而进行优化。希望本文能对您有所帮助,让您在开发过程中更高效地使用 Snapdragon Profiler 进行性能分析和优化。
56 10
|
22天前
|
Linux
Linux安装svn并启动
Linux安装svn并启动
55 10
|
1月前
|
缓存 安全 Linux
Linux系统查看操作系统版本信息、CPU信息、模块信息
在Linux系统中,常用命令可帮助用户查看操作系统版本、CPU信息和模块信息
131 23
|
1月前
|
Oracle 关系型数据库 Linux
linux8安装oracle 11g遇到的问题记录
Oracle 11g在Linux 8上安装时会遇到link编译环节的问题。官方建议忽略安装中的链接错误,安装完成后应用DBPSU 11.2.0.4.240716补丁及一次性补丁33991024,再重新编译二进制文件,并配置监听器和数据库。但因11g已退出服务期,这些补丁需付费获取。网上信息显示22年1月的PSU补丁也可解决问题,找到该补丁后按常规方式打补丁即可。如有需求或疑问可咨询我。
83 20
|
1月前
|
弹性计算 运维 Ubuntu
os-copilot在Alibaba Cloud Linux镜像下的安装与功能测试
我顺利使用了OS Copilot的 -t -f 功能,我的疑惑是在换行的时候就直接进行提问了,每次只能写一个问题,没法连续换行更有逻辑的输入问题。 我认为 -t 管道 功能有用 ,能解决环境问题的连续性操作。 我认为 -f 管道 功能有用 ,可以单独创建可连续性提问的task问题。 我认为 | 对文件直接理解在新的服务器理解有很大的帮助。 此外,我还有建议 可以在非 co 的环境下也能进行连续性的提问。
79 7
|
2月前
|
Linux Python
Linux 安装python3.7.6
本教程介绍在Linux系统上安装Python 3.7.6的步骤。首先使用`yum`安装依赖环境,包括zlib、openssl等开发库。接着通过`wget`下载Python 3.7.6源码包并解压。创建目标文件夹`/usr/local/python3`后,进入解压目录执行配置、编译和安装命令。最后设置软链接,使`python3`和`pip3`命令生效。
|
2月前
|
NoSQL 关系型数据库 MySQL
Linux安装jdk、mysql、redis
Linux安装jdk、mysql、redis
238 7
|
2月前
|
存储 监控 Linux
嵌入式Linux系统编程 — 5.3 times、clock函数获取进程时间
在嵌入式Linux系统编程中,`times`和 `clock`函数是获取进程时间的两个重要工具。`times`函数提供了更详细的进程和子进程时间信息,而 `clock`函数则提供了更简单的处理器时间获取方法。根据具体需求选择合适的函数,可以更有效地进行性能分析和资源管理。通过本文的介绍,希望能帮助您更好地理解和使用这两个函数,提高嵌入式系统编程的效率和效果。
126 13