1. 关闭防火墙和selinux
打开文件selinux
vim /etc/sysconfig/selinux
将文件中SELINUX=enforcing改为disabled,然后执行”setenforce 0″不用重启地关闭selinux。
SELINUX=disabled
关闭放火墙
systemctl stop firewalld.service如果不想关闭防火墙 就把端口加进去就可以查看防火墙的状态
不管当前防火墙的状态如何(重启或者开启防火墙自动启动)运行指令systemctl start firewalld.service
或者systemctl restart firewalld.servicefirewall-cmd --state
查看端口是否被开发
添加一个测试的端口8080并测试是否开放(此操作只作为测试用,inux重启的化端口又出来不对外开放)
添加一个开放的端口并写入配置文件中永久保存,重启防火墙并查看开放的端口
查看防火墙中对外公开的端口的配置文件
2.安装软件
2.1.MYSQL安装
下载mysql的repo源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装mysql-community-release-el7-5.noarch.rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装MYSQL
sudo yum install -y mysql-server
更改MYSQL用户权限:
sudo chown -R root:root /var/lib/mysql
重启服务:
systemctl restart mysql.service
登录,并修改密码:
mysql -u root
mysql > use mysql;
mysql > update user set password=password(‘123456‘) where user=‘root‘;
mysql > flush privileges;
mysql > exit;
CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
闲置已久的空间环境配置忘得差不多了,今天得空整理,重置了磁盘重新搭建环境,首先在CentOS 7.0安装MariaDB的数据库,在这里记录下安装过程,以便以后查看。
1、安装MariaDB
安装命令
yum -y install mariadb mariadb-server
安装完成MariaDB,首先启动MariaDB
systemctl start mariadb
设置开机启动
systemctl enable mariadb
接下来进行MariaDB的相关简单配置
mysql_secure_installation
首先是设置密码,会提示先输入密码
Enter current password for root (enter for none):<–初次运行直接回车
设置密码
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
初始化MariaDB完成,接下来测试登录
mysql -uroot -ppassword
完成。
2、配置MariaDB的字符集
文件/etc/my.cnf
vi /etc/my.cnf
在[mysqld]标签下添加
init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake
文件/etc/my.cnf.d/client.cnf
vi /etc/my.cnf.d/client.cnf
在[client]中添加
default-character-set=utf8
文件/etc/my.cnf.d/mysql-clients.cnf
vi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
default-character-set=utf8
全部配置完成,重启mariadb
systemctl restart mariadb
之后进入MariaDB查看字符集
mysql> show variables like "%character%";show variables like "%collation%";
显示为
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
字符集配置完成。
3、添加用户,设置权限
创建用户命令
mysql>create user username@localhost identified by 'password';
直接创建用户并授权的命令
mysql>grant all on *.* to username@localhost indentified by 'password';
授予外网登陆权限
mysql>grant all privileges on *.* to username@'%' identified by 'password';
授予权限并且可以授权
mysql>grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;
centos7 yum 方式安装nginx
centos7系统库中默认是没有nginx的rpm包的,所以我们自己需要先更新下rpm依赖库
(1)使用yum安装nginx需要包括Nginx的库,安装Nginx的库
#rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
(2)使用下面命令安装nginx
#yum install nginx
(3)启动Nginx
#service nginx start
或
#systemctl start nginx.service
https://www.cnblogs.com/jie-hu/p/5950584.html
配置yum源
追加CentOS 6.5的epel及remi源。
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
以下是CentOS 7.0的源。
# yum install epel-release# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)。
# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
安装PHP5.6
yum源配置好了,下一步就安装PHP5.6。
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
用PHP命令查看版本。
# php --version
https://blog.csdn.net/wszll_alex/article/details/76285324
安装php
rpm 安装 Php7 相应的 yum源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装php7.0
yum install -y php70w
安装php扩展
yum install -y php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64
安装PHP FPM
yum install -y php70w-fpm
3. 修改配置文件
3.1修改Nginx配置文件
nginx配置文件位置:(/etc/nginx/conf.d/default.conf)
vim /etc/nginx/conf.d/default.conf
修改 root目录,可自定义:
root /forest/nginxDir/html;
配置php解析,修改 下面代码中黑色加粗部分:
location ~.php$ { root /forest/nginxDir/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
3.2 修改php-fpm配置文件
php-fpm配置文件位置:(/etc/php-fpm.d/www.conf)
修改
user =nginx
group=nginx
按照上面方法装完lnmp环境 使用localhost访问 报No input file specified","File not found 错误
http://www.cnblogs.com/qq78292959/p/4034310.html
vi /etc/nginx/conf.d/default.conf
# fastcgi_param SCRIPT_FILENAME script$fastcgi_script_name
改为:
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; #指定路径
/usr/share/nginx/html 这个是你自己的服务路径
CentOS7 配置搭建安装LNMP相关推荐
- 编写shell脚本实现自动化搭建安装LNMP平台全过程配置详解
注意:如果是输入的是字母的或者是输入等于0时,则会出现以下两种情况!!! 查看端口: 进到Nginx根目录查看创建好的测试网页: 注意:关闭防火墙或者设置防火墙规则!!! 访问Nginx网页: 访问P ...
- linux配置分步安装lnmp环境----ghj
前台:nignx 后台:apache [linux命令] 用户 文件目录 启动 定时任务: [开启RZ命令] yum -y install lrzsz [防火墙] 防火墙配置文件: /etc/sysc ...
- centos7 环境搭建(LNMP)以及虚拟环境(python3)
系统:centos7 LNMP(centos7, nginx, mysql, python3) 云服务:腾讯云 1.python3安装 如果选择公共镜像安装的话,centos内置python2,是不会 ...
- centos7配置python3_Centos7安装并配置Python3环境
CentOS7自带的有python环境, 但是版本是2.7 1. 查看Python的位置 [root@centos bin]#whereis python python2:/usr/bin/pytho ...
- linux yum 安装dns,centos7配置YUM安装DNS服务
1.配置DNS地址vim /etc/resolv.conf nameserver 192.168.1.100 #注:这里的地址是你DNS服务器本机的地址 2.安装dns服务yum install bi ...
- centos7.0 lamp mysql_CentOS7 yum安装LNMP以及LAMP
简单记录在CentOS7下yum安装LNMP以及LAMP的过程. 首先配置防火墙 CentOS 7.0默认使用的是firewall作为防火墙 1.关闭firewall: systemctl stop ...
- centos7下搭建lnmp环境包含yum源直接安装和源码编译安装,以及php5.3和php7.6版本
LNMP环境的搭建 一.yum源直接搭建 1.安装epel源 2.安装mariadb 初始化mariadb 3.安装php模块 配置php-fpm 3.安装nginx 配置nginx 4.测试环境是否 ...
- Centos7快速搭建LNMP (Nginx + MySQL + PHP)
Centos7快速搭建LNMP (Nginx + MySQL + PHP) 1.安装前简单介绍一下yum 2.Nginx安装 3.MySQL安装(这里直接安装MySQL8) 3.1.安装前清理旧版本的 ...
- Centos7下使用yum安装lnmp zabbix3.2
1:配置epel-release mysql zabbix 源 配置epel源 wget http://mirrors.aliyun.com/epel/epel-release-latest-7.no ...
最新文章
- 基于道路标线的城市环境单目定位
- python如何爬虫网页数据-python网络爬虫爬取网页内容
- 利用iconv进行文件编码批量原地转换
- 笔记2——C++ static关键字与一维动态数组的使用
- python foreach用法_C# 中 foreach 遍历的用法
- nginx php7 win,Win7配置Nginx+PHP7
- go and git 代理
- 服务器系统怎么写,服务器操作系统语言写的
- 有意思的clip-path
- BCD码和ASCII码的区别
- Android手机怎么打开exe,安卓手机如何打开.exe文件 安卓手机exe文件怎么打开
- Latex入门简明教程
- 对四旋翼飞行器的分析
- 解决树莓派 Error -110 whilst initializing SD card的一种方法
- 【JavaWeb】实现网页验证码
- 如何在PPT中插入Visio文件
- windows查看并获取文件的md5值
- 购物中心智能管理系统该如何选择
- led手电筒烧灯珠_浅谈务优LED手电筒灯珠型号与区别技巧
- 电动机的故障听声音就可以判断
热门文章
- JS实现点击按钮切换图片
- html网页模板中文乱码,Flash中出现中文乱码的解决办法
- 零基础学C语言(第一天)
- 开发类 - DeepIn 安装 IDEA 并集成 Tomcat
- 中国极地考察船“雪龙”号在南极碰撞冰山 目前人船安全
- 25. Green Living 绿色生活
- html、css做一个带搜索图标的搜索框
- 玩客云5.9千兆固件、docker、青龙面板
- 论区块链技术如何赋能社交代币并打造创作者经济新局面
- csgo跳投指令_CSGO控制台进阶指令