远端使用本地代理
【远端】
vim /etc/ssh/sshd_config
# GatewayPorts yes
service sshd reload
【本地】
➜ ~ ssh -Nf -R 33333:127.0.0.1:22 root@119.*.*.*
root@119.*.*.*'s password:
【远端】
[root@node2 ~]# netstat -antp | grep 33333
tcp 0 0 0.0.0.0:33333 0.0.0.0:* LISTEN 954134/sshd: root
tcp6 0 0 :::33333 :::* LISTEN 954134/sshd: root
export http_proxy=127.0.0.1:33333
#export ftp_proxy=192.168.13.226:10086
#export https_proxy=192.168.13.226:10086
[root@node2 ~]# export http_proxy=127.0.0.1:33333
[root@node2 ~]# echo $http_proxy
127.0.0.1:33333
#验证
[root@node2 ~]# git clone https://github.com/kubernetes/kops.git -v
本地免密 ssh登录远端服务器
【本机】
➜ ~ sudo vim /etc/hosts
119.*.*.* node2
➜ ~ ssh-keygen -t rsa
➜ ~ ls -alhi .ssh/*
➜ ~ cat .ssh/id_rsa.pub
【远程】
[root@node2 ~]# vim .ssh/authorized_keys
追加公钥
【本地】
➜ ~ ssh root@node2
免密登录方案2
➜ Downloads scp -r ~/.ssh/id_rsa.pub root@hkdev3:/root/.ssh/authorized_keys
ssh root@hkdev3
免密登录方案3「推荐」
➜ Downloads ssh-copy-id root@hkdev3
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/x/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hkdev's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@hkdev'"
and check to make sure that only the key(s) you wanted were added.
以root直接登录主机「不需要输入root@」
➜ Downloads vim ~/.ssh/config
Host hkdev3
HostName hkdev3
User root
ssh hkdev3
iTerm2 rz/sz
➜ ~ brew install lrzsz
➜ ~ brew install axel
➜ ~ export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
开发环境搭建
apt install nginx-core
前端代码部署
nginx配置文件配置
root@iZj6c58j5vdhhxp4hxty8mZ:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@iZj6c58j5vdhhxp4hxty8mZ:~# nginx -s reload
服务端配置
主机名修改
ubuntu
hostname 查看当前主机名
sudo vim /etc/hostname 修改hostname文档中所有的旧主机名为新主机名
sudo vim /etc/hosts 修改hosts文档中所有的旧主机名为新主机名。
reboot