配置服务器自动部署流程

1,阿里云轻量服务器安装的 lnmp 环境,于是在 /var/www/html 目录下面创建用于自动部署项目的根目录 website
[root@i ~]# cd /
[root@i /]# ls
bin   dev  home  lib64       media  opt   root  sbin  sys  usr
boot  etc  lib   lost+found  mnt    proc  run   srv   tmp  var
[root@i /]# cd var
[root@i var]# cd www
[root@i www]# cd html
[root@i html]# chmod 0755 website #修改目录权限
[root@i html]# chown -R deployer:deployer website #递归修改目录和子级拥有者
[root@i html]# su deployer #切换到部署账号下
[deployer@i html]$ ssh-keygen -t rsa #生成部署密钥,全部为空
Generating public/private rsa key pair.
Enter file in which to save the key (/home/deployer/.ssh/id_rsa):
Created directory '/home/deployer/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
[deployer@i html]$
[deployer@i html]$ cd /home/deployer
[deployer@i ~]$ cd .ssh
[deployer@i .ssh]$ cat ./id_rsa.pub >> authorized_keys #创建文件

 2,把本机密钥复制到服务器,然后把服务器密钥复制到远程仓库

 

 

posted on 2019-06-03 17:19  风小可  阅读(318)  评论(0编辑  收藏  举报