centos6新系统初始化脚本
2023-02-18 16:44:18 时间
最近装机次数有点多,本来想写到这里的centos6 优化脚本与安全脚本,结果一想还是新开一个帖子吧。
centos源设置可以参考Centos源设置,老高推荐安装阿里源。
新机子先运行上面的脚本,再运行这个脚本
初始化脚本
yum update -y
yum groupinstall "development tools" -y
yum install zlib-devel bzip2-devel pcre-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel -y
yum install crontabs ntpdate vim python-devel zsh -y
chkconfig sendmail off
chsh -s /bin/zsh
yum install python-setuptools -y
easy_install pip
pip install virtualenv
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
ntpdate us.pool.ntp.org
rm -f /etc/localtime
cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
以下是一些免编译的rpm包,也就是由其他人编译好的软件包,用于迅速搭建服务器环境,如果你希望更高程度的自定义,请自行编译。
vpsmate
wget http://www.vpsmate.org/tools/install.py
python install.py
nginx
# http://nginx.org/packages/centos/
# http://nginx.org/packages/centos/6/x86_64/
vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/x86_64/
gpgcheck=0
enabled=1
yum update
yum install nginx
nodejs
https://github.com/creationix/nvm
or
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxf node-latest.tar.gz
cd node-latest
./configure
make && make install
mariaDB
vi /etc/yum.repos.d/MariaDB.repo
# 下面的内容可以由 https://downloads.mariadb.org/mariadb/repositories/ 得到
# MariaDB 5.5 CentOS repository list - created 2015-04-27 05:46 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
yum update -y
yum install MariaDB-client MariaDB-server MariaDB-devel -y
# 集群工具
yum install MariaDB-Galera-server MariaDB-client galera -y
service mysql start
mysql_secure_installation
Mysql
cd /tmp
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
yum localinstall mysql-community-release-el6-5.noarch.rpm
yum update -y
yum repolist enabled | grep "mysql.*-community.*"
yum install mysql-community-server
ll /usr/bin |grep mysql
mysql_secure_installation
php
# CentOS/RHEL 7.x:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#CentOS/RHEL 6.x:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# 安装php
yum install php56w php56w-opcache php56w-fpm php56w-mysqlnd php56w-pdo php56w-mssql php56w-pgsql php56w-mcrypt php56w-imap php56w-gd php56w-xml php56w-tidy php56w-soap php56w-pecl-xdebug php56w-pear php56w-pecl-memcache
# 运行php-fpm
service php-fpm restart
php与nginx
此段配置不好容易发生404
server {
listen 80;
# server_name localhost;
server_name xxxxx;
#charset koi8-r;
access_log /var/log/nginx/log/host.access.log main;
root /var/www/html;
index index.php index.html index.htm;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
gcc
在centos上升级gcc费力费时,直接用编译好的gcc是条捷径!
在此我们借助Red Hat Developer Toolset x
下面的脚本分4.7 & 4.8
# Tru Huynh of centos.org has built the redhat developer toolset 1.1, for centos and it contains gcc 4.7.2
cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++
# This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/
# Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable
export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++
4.8
Known issues:
- unsigned packages -CentOS-6 devtoolset-2 needs devtoolset-2-ide which contains the whole Eclipse stack, but does not build yet
- CentOS-6 all the maven related file are not built either
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-binutils
yum install devtoolset-2-gcc-gfortran
Rerference:
http://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html http://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos https://webtatic.com/packages/php56/
相关文章
- PromQL 增强工具 PromLens 以开源方式捐赠给 Prometheus 组织
- 开源云原生应用生命周期编排工具 - Keptn
- 使用 Grafana、Prometheus 和 Slack 构建一个简单的 ChatOps 机器人
- toB应用私有化交付技术发展历程和对比
- 实测腾讯高精定位:赋能车道级导航 对驶入应急车道、车道级偏航等驾驶行为及时响应
- 10 个你需要熟悉的 CSS3 属性
- RPC接口测试技术-websocket 自动化测试实践
- 软件测试|web前端的HTML浅析
- 技术分享 | Spring Boot 异常处理
- 软件测试|Scrcpy工具码流格式化
- 软件测试|常用测试策略与测试手段
- AutoCAD Electrical 2020(电气版)软件安装教程--cad所有版本!
- AutoCAD Architecture 2020(建筑版)软件安装教程--cad所有版本!
- AutoCAD 2022软件免费下载及安装教程--cad所有版本!
- 软件测试|Rpc接口压测
- CleanMyMacX2023中文版Mac系统清理优化工具
- R语言稀疏主成分分析SPARSEPCA、因子分析、KMO检验和Bartlett球度检验分析上市公司财务指标数据
- NLP自然语言处理—主题模型LDA案例:挖掘人民网留言板文本数据|附代码数据
- 生态学建模:增强回归树(BRT)预测短鳍鳗生存分布和影响因素|附代码数据
- 数据分享|R语言用主成分PCA、 逻辑回归、决策树、随机森林分析心脏病数据并高维可视化|附代码数据