服务器基本环境搭建(个人备份

基本环境:Centos7.2

0.使用阿里云源,安装必备软件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache && yum upgrade && yum update
yum install -y vim git curl wget expect

ps:常用脚本
ssh登录

#!/usr/bin/expect 
spawn ssh -i ~/.ssh/id_rsa www.xxx.com -p xxx
expect "*pass" 
send "xxx\r" 
expect "*#" 
interact

1.配置zsh

yum -y install zsh
chsh -s /bin/zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
修改主题:
$ vim ~/.zshrc
:10 
ZSH_THEME="ys"  //将ZSH_THEME改成ys
:54
plugins=(!git sudo z colored-man-pages) //加载一些插件
:wq
$ source ~/.zshrc   //更新配置:

2.安装docker

yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
systemctl start docker
systemctl enable docker

参考Docker安装官方文档

3.安装nginx-proxy-companion反代容器

mkdir -p /path/to

curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > /path/to/nginx.tmpl

docker run -d -p 80:80 -p 443:443 \
    --name nginx \
    -v /etc/nginx/conf.d  \
    -v /etc/nginx/vhost.d \
    -v /usr/share/nginx/html \
    -v /path/to/certs:/etc/nginx/certs:ro \
    --label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy \
    nginx
    
docker run -d \
    --name nginx-gen \
    --volumes-from nginx \
    -v /path/to/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    --label com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen \
    jwilder/docker-gen \
    -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf

docker run -d \
    --name nginx-letsencrypt \
    --volumes-from nginx \
    -v /path/to/certs:/etc/nginx/certs:rw \
    -v /var/run/docker.sock:/var/run/docker.sock:ro \
    jrcs/letsencrypt-nginx-proxy-companion

参考:docker-letsencrypt-nginx-proxy-companion

4.拉取常用镜像

docker pull php:7.2-apache
//docker run -e VIRTUAL_HOST=xxx.com -e LETSENCRYPT_HOST=xxx.com -e LETSENCRYPT_EMAIL=xxx.com --name xxx -v /var/app/xxx:/var/www/html  -d php:7.2-apache
docker pull mysql:5.7
//docker run --name mysql -e MYSQL_ROOT_PASSWORD=xxxxxx -d mysql:5.7
docker pull eduardoleoni/ubuntu16-apache-php7
//docker run -e VIRTUAL_HOST=xxx.com -e LETSENCRYPT_HOST=xxx.com -e LETSENCRYPT_EMAIL=xxx.com --name xxx -v /var/app/xxx:/app -d duardoleoni/ubuntu16-apache-php7
docker pull justarchi/archisteamfarm
//docker run -it --name asf justarchi/archisteamfarm
//docker cp primary.json asf:/app/config
//primary.json example:
{
        "AcceptGifts": false,
        "AutoDiscoveryQueue": false,
        "CardDropsRestricted": true,
        "CustomGamePlayedWhileFarming": null,
        "CustomGamePlayedWhileIdle": null,
        "DismissInventoryNotifications": false,
        "Enabled": true,
        "FarmingOrder": 0,
        "FarmOffline": false,
        "GamesPlayedWhileIdle": [730,433850,570,578080],
        "HandleOfflineMessages": false,
        "IdleRefundableGames": true,
        "IsBotAccount": false,
        "LootableTypes": [
                1,
                3,
                5
        ],
        "MatchableTypes": [
                5
        ],
        "PasswordFormat": 0,
        "Paused": false,
        "RedeemingPreferences": 0,
        "SendOnFarmingFinished": false,
        "SendTradePeriod": 0,
        "ShutdownOnFarmingFinished": false,
        "SteamLogin": "loosewan",
        "SteamMasterClanID": 103582791460246407,
        "SteamParentalPIN": "0",
        "SteamPassword": "xxxxx",
        "SteamTradeToken": null,
        "SteamUserPermissions": {},
        "TradingPreferences": 0
}
参考:https://github.com/JustArchi/ArchiSteamFarm/wiki/Docker
docker pull ubuntu
//docker run -it -d --name script ubuntu

汤一碗博客
请先登录后发表评论
  • 最新评论
  • 总共0条评论