最小化安装CentOS7 + xfce4 +PHP + nginx +mariadb 开发环境
虚拟机自定义最小化安装,新增用户做为管理员,打开自动获取网络,桥接模式。
所有的操作只有命令,不做解释,看不明白的可以自行搜索相关的资料。
# 开头的行是注释行,# 开头的空行,我自己装机时做了快照。未完待续
1 安装CentOS7 过程: 2 3 # 最小化安装完成快照 4 5 sudo yum install -y wget 6 7 # http://mirrors.163.com/.help/centos.html 8 9 sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 10 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo -O /tmp/CentOS-Base.repo 11 sudo mv /tmp/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo 12 13 sudo yum install -y epel-release 14 15 sudo yum clean all 16 sudo yum makecache 17 sudo yum update 18 19 sudo yum groupinstall -y "X window system" 20 sudo yum groupinstall -y xfce 21 22 sudo yum install -y firefox 23 sudo yum install -y cjkuni-ukai-fonts 24 25 # 26 27 sudo yum -y install mariadb* 28 sudo systemctl start mariadb.service 29 mysql_secure_installation 30 31 mysql -u root -p 32 CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 33 GRANT privileges ON databasename.tablename TO 'username'@'host' WITH GRANT OPTION; 34 35 SHOW VARIABLES LIKE 'character%'; 36 37 #要修改的配置文件位于 /etc/my.cnf.d。 网上大部分的没有说明这个文件夹,和下面要修改的文件 38 39 sudo vi /etc/my.cnf.d/client.cnf 40 #client.cnf 在[client]节里加入default-character-set=utf8 41 42 sudo vi /etc/my.cnf.d/server.cnf 43 #server.cnf 在[mysqld]节里加入character-set-server=utf8 44 45 sudo systemctl restart mariadb 46 sudo systemctl enable mariadb 47 48 lsmod | grep piix4 49 #i2c_piix4 22106 0 50 #i2c_core 40325 2 drm,i2c_piix4 51 sudo vi /etc/modprobe.d/blacklist.conf 52 #新增一行 blacklist i2c_piix4 53 reboot 54 55 # 56 57 sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent 58 sudo firewall-cmd --reload 59 60 sestatus 61 62 sudo vi /etc/selinux/config 63 #SELINUX=enforcing #注释掉 64 #SELINUXTYPE=targeted #注释掉 65 SELINUX=disabled #增加 66 :wq! #保存退出 67 68 sudo vi /etc/modprobe.d/blacklist.conf 69 #加入 blacklist intel_rapl 70 71 sudo yum install -y redis 72 sudo yum install -y nginx 73 sudo yum install -y php 74 sudo yum install -y php-fpm 75 76 sudo firewall-cmd --zone=public --add-port=6379/tcp --permanent 77 sudo firewall-cmd --zone=public --add-port=80/tcp --permanent 78 sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent 79 sudo firewall-cmd --reload 80 81 # 82 83 84 85
1 sudo vi /etc/redis.conf 2 3 #requirepass 设置访问密码 4 5 #如果有必要将bind 127.0.0.1 去掉,可以远程访问 6 7 #此种启动模式,使用的配置文件是/etc/redis.conf 8 sudo systemctl enable redis 9 10 sudo yum install -y php-pecl-xdebug 11 sudo yum install -y git 12 13 sudo yum install -y gcc 14 sudo yum install -y net-tools 15 16 sudo mkdir /mnt/cdrom 17 sudo mount /dev/cdrom /mnt/cdrom/ 18 cd /mnt/cdrom 19 ls 20 cp VMwareTools-10.0.0.2977863.tar.gz /tmp/vmtools.tar.gz 21 cd /tmp 22 tar zxvf vmtools.tar.gz 23 cd vmware-tools-distrib 24 sudo ./vmware-install.pl 25 26 27 sudo yum install -y java 28 sudo yum install -y php-devel 29 sudo pecl channel-update pecl.php.net 30 sudo pecl install apc 31 32 sudo vi /etc/nginx/nginx.conf 33 #修改用户 34 cd /var/log 35 sudo chown -R jack_du:jack_du nginx 36 37 /home/jack_du/PhpStorm-141.2462/bin/phpstorm.sh 38 39 sudo vi /etc/php-fpm.d/www.conf 40 #修改用户 41 42 cd /var/log 43 sudo chown -R jack_du:jack_du php-fpm 44 45 sudo yum install -y php-pecl-apc 46 sudo yum install -y php-gd 47 sudo yum install -y php-mcrypt 48 sudo yum install -y php-pecl-redis 49 sudo yum install -y php-pdo 50 51 sudo systemctl disable httpd 52 53 sudo vi /etc/nginx/conf.d/default.conf 54 55 server { 56 listen 8080; 57 server_name localhost; 58 root /usr/share/nginx/default; 59 index index.php index.html index.htm; 60 61 location /{ 62 } 63 64 # nginx passes PHP scripts to FastCGI server via a TCP/9000 socket 65 # this setting much be consistent with /etc/php-fpm.d/www.conf 66 # try_files prevents nginx from passing bad scripts to FastCGI server 67 68 location ~ \.php$ { 69 try_files $uri =404; 70 fastcgi_pass 127.0.0.1:9000; 71 fastcgi_index index.php; 72 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 73 include fastcgi_params; 74 } 75 } 76 77 78 sudo chown -R jack_du:jack_du /usr/share/nginx 79 80 sudo systemctl restart php-fpm 81 sudo systemctl restart nginx 82 83 ssh-keygen -t rsa -C "jack_du@163.com" 84 85 sudo systemctl enable php-fpm 86 sudo systemctl enable nginx 87 88 sudo yum install -y bzip2 89 sudo yum install -y gcc-c++
每天进步一点点,有时间先装修空间哈