1.启动vagrant虚拟机,设置网络为public_network,并用putty连接上虚拟机
注意:ssh 登录虚拟机是的用户名和密码皆为vagrant
2.查看虚拟机ip地址,通过命令ifconfig,如果此命令不可用,可使用ip addr show
提示:修复ifconfig不可用的方法,安装net-tools包,sudo yum install net-tools -y
别执行yum update,这样会升级centos系统到最新版本
如果是自己搭建的服务器,如果外部无法访问,请检查selinux配置和防火墙配置
参考以下文章:
1.http://www.orcs.cc/post/6.html
2.http://www.linuxidc.com/Linux/2015-05/117473.htm
3.添加仓库
sudo yum install https://centos7.iuscommunity.org/ius-release.rpm -y
然后查看仓库列表 yum repolist
4.安装nginx: sudo yum install nginx -y
启动nignx: sudo systemctl start nginx
开机自启动: sudo systemctl enable nginx
5.安装mariadb
查找mariadb可用版本: yum search mariadb
选择mariadb101u-server,表示安装mariadb 10.1版本
sudo yum install mariadb101u-server -y
此安装过程会出现一个冲突的提示,原因是centos7内置安装了mariadb,先删除掉这个有冲突的包
sudo yum remove mariadb-libs -y
再执行安装过程,然后
启动mariadb: sudo systemctl start mariadb
开机自启动: sudo systemctl enable mariadb
接下来执行安全相关的配置
执行mysql_secure_installation
提示输入当前用户的密码,直接回车
提示是否设置root用户密码:输入Y
再输入并确认输入密码
是否删除匿名用户:Y
设置完成后重新加载配置:Y
6.安装php-fpm
sudo yum install php70u-fpm -y
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
sudo yum install php70u-gd php70u-xml php70u-mysqlnd php70u-pdo php70u-mcrypt php70u-mbstring php70u-json -y
sudo systemctl reload php-fpm
7.创建nginx配置
sudo vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name 192.168.199.103;
root /home/www/default;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
sudo mkdir -p /home/www/default
sudo chown -R root /home
创建测试php文件
<?php phpinfo(); ?>
sudo systemctl reload nginx
8.安装composer
sudo yum install php70u-cli -y
composer官方网站安装
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
echo $PATH
sudo mv composer.phar /usr/local/bin/composer
sudo vi ~/.bash_profile
:$HOME/.composer/vendor/bin
source ~/.bash_profile
9.安装git
sudo yum install git2u -y
git --version
sudo yum remove git-core -y
git config --global user.name "town"
git config --global user.email "xxxx@qq.com"
10.安装drush
composer global require drush/drush
/root/.config/composer添加到bash_profile
:$HOME/.config/composer/vendor/bin
11.安装vsftpd
sudo yum install vsftpd
sudo systemctl start vsftpd
sudo vi /etc/vsftpd/vsftpd.conf
修改anonymous_enable=NO
useradd -d /home/www/default -s /sbin/nologin townftp
passwd
ctrl+l 清空屏幕
chown -R townftp /home/www/default
chmod -R 755 /home/www/default
然后通过客户端软件连接ftp服务器
-转于http://www.hukouhome.com/node/10
- Log in to post comments