Centos7 配置LAMP

安装apache
安装apache
yum install httpd httpd-devel

启动apache服务
systemctl start httpd	#启动服务
systemctl status httpd	#查看状态
systemctl enable httpd	#设置开机自动启动服务

查看服务器IP并用浏览器登录页面
ip a
http://192.168.0.61
安装mysql
yum install mariadb mariadb-server mariadb-libs mariadb-devel		#安装相关组件
rpm -qa |grep maria	#检查安装结果
	[root@localhost ~]# rpm -qa |grep maria
	mariadb-5.5.60-1.el7_5.x86_64
	mariadb-server-5.5.60-1.el7_5.x86_64
	mariadb-libs-5.5.60-1.el7_5.x86_64
	mariadb-devel-5.5.60-1.el7_5.x86_64

systemctl start mariadb		#启动mariadb
systemctl status mariadb	#查看服务状态
systemctl enable mariadb	#设置开机自动启动服务
使用mysql_secure_installation初始化数据库安全设置
  • 输入root密码,没有密码直接回车

  •   [root@localhost ~]# mysql_secure_installation
      
      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...
    
  • 提示设置root user密码,Y

  •   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!
    
  • 删除系统创建的默认匿名用户:Y

  •   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!
    
  • 禁止root用户远程登录:Y

  •   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!
    
  • 是否删除系统创建的test数据库,生产环境建议删除

	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.
  • 重载权限表: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!

猜你喜欢

转载自blog.csdn.net/weixin_43257494/article/details/82821416
今日推荐