CentOS7.2web环境配置手记

安装SVN
yum install -y subversion
显示版本:
svnserve --version

创建目录:
mkdir </home/svn/>
cd </home/svn/>
创建版本库:
svnadmin create </home/svn/yunms(项目名称)>
cd </home/svn/yunms>
ls(查看自动生成的文件)
conf db format hooks locks README.txt

修改配置:(切记:配置项前不能留空格)
cd conf

创建用户组和用户
vi authz
[组] = [用户1],[用户2],……

[yunms(项目名称):/]
@[组] = rw(读写权限)

配置用户名、密码
vi passwd
[用户1] = [密码]
[用户2] = [密码]

配置svnserve.conf

anon-access = none //匿名用户访问权限:无
auth-access = write //普通用户访问权限:读、写
password-db = passwd //密码文件
authz-db = authz //权限配置文件
realm = /home/svn/yunms //版本库所在

启动svn

svnserve -d -r /home/svn(目录)

kill进程:killall svnserve

测试:
cd /home/yunms
svn co svn://localhost/yunms(项目名)

vn更新自动同步到web目录:
svn co svn://localhost/yunms /home/yunms --username <用户名> --password <密码>

新建配置文件:
cd </home/svn/yunms/hooks>
vi post-commit

#!/bin/sh
export LANG=en_US.utf8
SVN_PATH=/usr/bin/svn
WEB_PATH=/home/yunms #web访问目录
$SVN_PATH update $WEB_PATH --username '<用户名>' --password '<密码>' --no-auth-cache

chown nginx:nginx post-commit //修改用户组和用户
chmod 755 post-commit //权限

重启:
[killall svnserve]
svnserve -d -r /home/svn
============================================================================
安装php7:
添加源
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安装
yum install php70w
安装插件
yum install php70w-opcache php70w-fpm php70w-bcmath php70w-cli php70w-common php70w-dba php70w-devel php70w-embedded php70w-enchant php70w-gd php70w-imap php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysqlnd php70w-odbc php70w-pdo_dblib php70w-pear php70w-pecl-apcu php70w-pecl-imagick php70w-pecl-mogondb php70w-pecl-redis php70w-pecl-xdebug php70w-pgsql php70w-phpdbg php70w-process php70w-pspell php70w-recode php70w-snmp php70w-soap php70w-tidy

修改配置文件:
/ect/php-fpm.conf
/etc/php-fpm.d/*.conf(www.conf)

vi www.conf(修改用户和用户组)
user = nginx
group = nginx
==============================================================================
安装ngnix
添加源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装
yum install nginx

修改配置文件:
/etc/nginx.conf
/etc/nginx/conf.d/*.conf(deftault.conf)

vi default.conf

location ~ \.php$ {
root /home/www(web站点目录);
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

反向代理:

server {
listen 80;
server_name yun.cn www.yun.cn(域名);
location / {
proxy_pass http://127.0.0.1:8000;
}
}

测试配置文件:
nginx -t

启动:
systemctl start nginx.service或service nginx start
nginx -s stop/quit/reopen/reload


查看nginx服務目前的啟動設定
systemctl list-unit-files | grep nginx
开机自动启动
systemctl enable nginx


停止apache:
systemctl stop httpd.service
重新apache:
systemctl restart httpd.service
================================================================================
Nodejs
安装NVM(nodejs版本管理软件):
curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash(退出终端)
追加源:
source ~/.bash_profile
查看nodejs版本号:
nvm ls-remote
安装nodejs:
nvm install <版本号>
================================================================================
安装mysql

wget http://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum -y install mysql-server

启动/重启:
service mysqld start/restart
设置开机启动:
chkconfig mysqld on
查看mysql随机密码:
sudo grep "password" /var/log/mysqld.log 或grep 'temporary password' /var/log/mysqld.log
修改密码:
mysqladmin -u root -p password
<oldpassword>
<newpassword>
设置远程访问:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '!Xueand123!' WITH GRANT OPTION;
FLUSH PRIVILEGES;
==================================================================================
安装Mongodb
创建yum仓库:
touch /etc/yum.repos.d/mongodb-org-3.2.repo
vi /etc/yum.repos.d/mongodb-org-3.2.repo

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

执行安装:
yum install -y mongodb-org

启动:
mongod -f /etc/mongod.conf

创建用户:
db.createUser({user:"admin",pwd:"password",roles:[{role:"__system",db:"admin"}]})

存放路径:
path:/var/log/mongodb/mongod.log
dbPath:/var/lib/mongo

配置mongod.conf:
#bindIp: 127.0.0.1(远程访问)

killall mongod(切记:不要用kill -9 <pid>)

启动:
mongod --auth --fork -f /etc/mongod.conf
--auth(带权限验证),--fork(后台运行)


远程连接:
mongo -u <user> -p <pass> --host <host> --port 27017

客户端退出:
use admin
db.shutdownServer()


yum方式卸载mongodb:

yum erase $(rpm -qa | grep mongodb-org)
rm -r /var/log/mongodb
rm -r /var/lib/mongo

===============================================================================
查看系统版本号:
lsb_release -a
cat /etc/redhat-release


新建/删除用户:
adduser <username>/userdel <username>
修改用户密码:
passwd <username>
删除用户以及用户目录:
userdel -f <username>

新建/删除用户组:
groupadd <groupname>/groupdel

查看已安装的软件包:

yum list installed | grep <软件名>
rpm -qa | grep <软件名>

yum安装/删除:

yum -y install <包名>/yum -y remove <包名>

查看所有端口:
netstat -ntlp
查看某个端口:
netstat -lnp|grep 端口号


环境变量:
vi /ect/profile

 

posted @ 2016-10-07 17:33  yudis  阅读(859)  评论(0编辑  收藏  举报