安装yum-priorities插件
该插件的作用主要是设置调用源时的优先级的,一般将官方的优先级设置为最高
yum install yum-priorities –y
vi /etc/yum.repos.d/CentOS-Base.repo
在每个[]段的最后加上priority=[]字段来设置每个镜像的优先级,1为最高,99为最低
一般的配置为:
[base], [updates], [extras] … priority=1 [CentOSplus],[contrib] … priority=2
下载与安装相应 EPEL 的 rpm 文件包
rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
上面的地址是64位,根据自己的需求找到对应包地址
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
vi /etc/yum.repos.d/epel.repo
设置 /etc/yum.repos.d/epel.repo 中源的级别为 priority=11
(比上面高就行)
下载与安装相应 rpmforge 的 rpm 文件包
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
上面的地址是64位,根据自己的需求找到对应包地址
wget http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm --import RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
//检查安装文件
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
//安装程序
vi /etc/yum.repos.d/rpmforge.repo
设置 /etc/yum.repos.d/rpmforge.repo 文件中源的级别为 priority=12
(比上面高就行)
下载与安装相应rpmfusion的 rpm 文件包
rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/x86_64/rpmfusion-free-release-6.1.noarch.rpm
rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/x86_64/rpmfusion-nonfree-release-6-1.noarch.rpm
设置下面4个文件中源的级别为 priority=13
(比上面高就行):
vi /etc/yum.repos.d/rpmfusion-free-updates.repo
vi /etc/yum.repos.d/rpmfusion-free-updates-testing.repo
vi /etc/yum.repos.d/rpmfusion-nonfree-updates.repo
vi /etc/yum.repos.d/rpmfusion-nonfree-updates-testing.repo
下载与安装相应webtatic的 rpm 文件包
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
设置下面3个文件中源的级别为 priority=20
(比上面高就行):
vi /etc/yum.repos.d/webtatic.repo
vi /etc/yum.repos.d/webtatic-testing.repo
vi /etc/yum.repos.d/webtatic-archive.repo
载入yum-priorities插件
yum check-update
安装nginx
yum install nginx18
设置系统启动时自动运行nginx:
chkconfig --level 345 nginx on
设置nginx在运行级别为3、4、5的情况下都是on(开启)的状态
--level<等级代号> 指定读系统服务要在哪一个执行等级中开启或关毕。
等级0表示:表示关机
等级1表示:单用户模式
等级2表示:无网络连接的多用户命令行模式
等级3表示:有网络连接的多用户命令行模式
等级4表示:不可用
等级5表示:带图形界面的多用户模式
等级6表示:重新启动
查看自动运行设置是否成功:
chkconfig –-list
启动nginx:
/etc/init.d/nginx start
重新启动:
service nginx restart
重新加载配置:
nginx -s reload
问题:nginx的权限问题
(13: Permission denied)
-
解决:先查看nginx配置文件里面的user是nginx,确定是否能访问sites目录
sudo -u nginx stat /sites若不能访问,则把nginx用户添加到能访问的用户组里:
gpasswd -a nginx root
重新加载nginx配置文件
Php在Nginx中的配置(包括Thinkphp):
location / {
#root html;
root /var/www/html;
index index.html index.htm index.php;
}
location /pocket/ {
root /var/www/html;
index index.html index.htm index.php;
#try_files $uri /index.php$uri;
if (!-e $request_filename) {
rewrite ^/pocket/(.*)$ /pocket/index.php/$1 last;
break;
}
}
location ~ .+\.php($|/) {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi.conf;
}
安装php
yum install php56w
安装php其他模块:
yum install php56w-gd php56w-mysql php56w-mbstring php56w-xml php56w-mcrypt
yum install php56w-pecl-redis
问题:Thinkphp遇到STORAGE_WRITE_ERROR错误
-
解决:目录下把权限改为775:
sudo chmod -R 775 /root/Sites/pocket/Runtime
安装php-fpm
yum install php56w-fpm
设置系统启动时自动运行:
chkconfig --level 345 php-fpm on
启动:
/etc/init.d/php-fpm start
重新启动:
service php-fpm restart
在/etc/php-fpm.d/www.conf
里把用户和组都改为nginx,重启服务
安装mysql
先导入一个repo的包:
yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
安装mysql:
yum install mysql mysql-devel mysql-server mysql-utilities
如果遇到:mysql-libs-5.1 conflicts with file from package MySQL-server-5.5
的问题,先执行:yum remove mysql-libs-*
设置系统启动时自动运行:
chkconfig --level 345 mysqld on
登录mysql:
mysql -u root -p
启动:
service mysqld start
重新启动:
service mysqld restart
设置mysql密码:
/usr/bin/mysqladmin -u root password ‘123456'
定时备份:
-
新建文件:
mysql-backup.sh
db_user="pocket"db_passwd="xxxxxx" db_host="127.0.0.1" db_name="pocket" # the directory for story your backup file. backup_dir="/usr/backup" # date format for backup file (dd-mm-yyyy) time="$(date +"%Y-%m-%d-%H-%M-%S")" # mysql, mysqldump and some other bin's path MYSQL="/usr/bin/mysql" MYSQLDUMP="/usr/bin/mysqldump" GZIP="/bin/gzip" $MYSQLDUMP -u $db_user -h $db_host -p$db_passwd $db_name | $GZIP -9 > "$backup_dir/$db_name"_"$time.gz"
chmod 700 mysql-backup.sh
-
只允许管理员运行此脚本
编辑/etc/crontab,在最后一行添加: 00 3 * * * root /usr/backup/mysql-backup.sh #表示每天3点钟执行一次备份
-
重新启动crontab:
/etc/rc.d/init.d/crond restart
安装Redis
yum install redis
设置系统启动时自动运行:
chkconfig --level 345 redis on
启动:
service redis start
重新启动:
service redis restart
安装PhpMyAdmin
下载:http://www.phpmyadmin.net/
把phpmyadmin文件夹放入网站目录
复制libraries下的config.sample.inc.php文件粘贴为新的config.inc.php,依次找配置即可
添加:$cfg['SessionSavePath'] = '/tmp’;
问题:
Warning in ./libraries/session.inc.php Permission denied
解决:找到php.ini配置文件,删掉
session.save_path = "/tmp”
前面的分号,重启nginx和php-fpm
安装Mysql-Bench
yum install mysql-workbench-community
在Application菜单下会看见MysqlBench的应用程序
安装Sublime
wget http://c758482.r82.cf2.rackcdn.com/Sublime\ Text\ 2.0.2\ x64.tar.bz2
tar vxjf Sublime\ Text\ 2.0.2\ x64.tar.bz2
sudo mv Sublime\ Text\ 2 /opt/
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime
安装SmartGit
http://www.syntevo.com/smartgit/
sudo 运行smartgit.sh文件
安装JRE
yum install java-1.8.0-openjdk.x86_64
安装CRON
yum install vixie-cron
How to Install Git 1.8.3.4 on CentOS 6.4
-
Check the CentOS version
$ cat /etc/redhat-release
CentOS release 6.4 (Final)
-
Check git version
$ git --version
git version 1.7.1
-
Enable/disable yum proxy settings (find/add "proxy" string with related proxy server)
$ vim /etc/yum.conf
-
Try to update git via yum package manager. But you will get the message that git is up to date
$ sudo yum update git
-
Based on instruction from Getting Started Installing Git install git from sources:
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc
$ wget https://www.kernel.org/pub/software/scm/git/git-1.8.3.4.tar.gz
$ tar xzvf git-1.8.3.4.tar.gz
$ cd git-1.8.3.4
$ sudo make prefix=/usr/local all
$ sudo make prefix=/usr/local install
-
Re-run bash shell and verify the current git version
$ git --version
git version 1.8.3.4
查看CentOS系统版本
root@MyMail ~ # cat /etc/redhat-release
CentOS release 5.4 (Final)
安装JDK
yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
java -version
SSH拷贝
scp [email protected]:/home/root/A /home/B
这个的意思是将主机192.168.1.100 /home/root/A文件 拷贝到本地/home/ 并重命名为B
CentOS 下安装 Tomcat 8
http://www.cragsman.org/index.php?m=content&c=index&a=show&catid=92&id=306
安装Jenkins
http://www.tuicool.com/articles/ZB3I7jZ
查看CentOS系统版本
cat /etc/issue
安装Android SDK
http://fpliu-blog.chinacloudsites.cn/it/os/android/sdk/installation/on-centos
http://www.cnblogs.com/milton/p/4395304.html