centos安装记录
-
使用iso文件写入centos iso文件
-
开机启动设置U盘直接安装, 不修改配置文件。 直接在安装时设置里打开网络,九可以跳过第 4 条。
-
默认未安装wget ,x-windows,nano
-
配置网络
vi /etc/sysconfig/network-scripts/ifcfg-网卡名称不同而不同
ONBOOT=yes //将ONBOOT="no"改为ONBOOT="yes"
service network restart
-
安装ifconfig
yum -y install net-tools
-
安装wget
yum -y install wget
-
更换阿里yum源
CentOS系统更换软件安装源
- 第一步:备份你的原镜像文件,以免出错后可以恢复。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 第三步:运行yum makecache生成缓存
yum clean all
yum makecache
-
安装x-windows
yum groupinstall "GNOME Desktop" -y
-
centos7 yum 安装nginx
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx
-
yum 安装mysql
-
下载mysql的repo源
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
-
安装rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
-
安装mysql
yum install mysql-server
-
/var/lib/mysql 改为当前用户权限
sudo chown -R openscanner:openscanner /var/lib/mysql
-
登陆,重置mysql root密码
1 2
mysql > mysql -u root mysql > update user set password=password(‘123456‘) where user=‘root‘;
-
刷新权限
1
FLUSH PRIVILEGES;
-
开放防火墙3306 端口
sudo vim /etc/sysconfig/iptables
添加以下内容
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
重启防火墙
service iptables restart
-
安装php
yum install php php-fpm
- 配置nginx 支持php
inde 增加 index.php
1 2 3 4 5 6 7
location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
- php配置
vi /etc/php.ini
- 配置 php-fpm
vi /etc/php-fpm.d/www.conf