码迷,mamicode.com
首页 > Windows程序 > 详细

jenkins结合windows 2019 server系统的wcl子系统ubuntu通过rsync传送代码到windows中

时间:2020-09-21 11:50:44      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:mit   windows   and   mkdir   arc   ror   ble   mod   重启   

1.进入c:/windows/system32/windowsPowerShell/v1.0目录,以管理员身份启动powershell.exe程序
运行以下命令开启wcl功能,需要重启windows系统
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

技术图片
技术图片
2.下载ubuntu系统
 https://docs.microsoft.com/en-us/windows/wsl/install-manual
下载ubutnu18.04,默认下载到C:\Users\Administrator>目录

https://aka.ms/wsl-ubuntu-1804

cd ~
# 重命名系统名称为zip可解压文件
PS C:\Users\Administrator> Rename-Item Ubuntu1804.appx Ubuntu1804.zip
# 解压ubuntu系统
Expand-Archive Ubuntu1804.zip Ubuntu1804

技术图片

解压文件后,可以看到如图的文件目录内容。

技术图片

3.安装 Linux 子系统

打开 ubuntu1804.exe 即可开始进入命令行安装界面:

技术图片

提示创建用户

技术图片

用户:mediaiouser
密码:pass

3.在ubutu中安装rsync服务
实际ubuntu已经自带了rsync服务,只需要启用即可
创建配置
# cp /usr/share/doc/rsync/examples/rsyncd.conf /etc
# 编辑配置

vim  /etc/rsyncd.conf

[apache_test.chinasoft.com]
path = /mnt/c/Users/Administrator/wwwroot/test.chinasoft.com
uid = mediaiouser # 需要特别强调
gid = mediaiouser # 一定要注明
use chroot = false
read only = false
transfer logging = yes
secrets file = /etc/rsyncd.secrets

# 创建密码文件
root@eus-media-api02:/# more /etc/rsyncd.secrets
mediaiouser:mediawinlinuxpass

# 修改密码文件权限
# chmod 600  /etc/rsyncd.secrets
# chown root.root  /etc/rsyncd.secrets

# 启动rsync服务
/etc/init.d/rsync start

# 创建需要rsync接收文件的目录
mkdir -p /mnt/c/Users/Administrator/wwwroot/test.media.io
chown -R mediaiouser. Mediaiouser /Users/Administrator

关于权限的说明:
1.    ubuntu下的/mnt/c对应c盘
2.    要用root用户启动rsync服务
3.    授权rsync推送目标目录为rsyncd.secrets密码文件中指定的用户


rsync同步时报错:
 [apache@jenkins_server:/usr/local/worksh/jeninks_task]$ ./api02_media_io_go.media.io.sh
 /data/www/vhosts/test.media.io/ 可以发布
####################rsync 150.238.16.180 start################################
sending incremental file list
rsync: failed to set times on "." (in apache_test.media.io): Operation not permitted (1)
./
aa.html
             12 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/2)
rsync: mkstemp ".aa.html.34rJd9" (in apache_test.media.io) failed: Operation not permitted (1)

sent 138 bytes  received 230 bytes  147.20 bytes/sec
total size is 12  speedup is 0.03
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]
################### rsync end #######################

加入这个即可:
uid = mediaiouser # 需要特别强调
gid = mediaiouser # 一定要注明


通过以上的使用可以看出,wcl子系统可以和windows进行资源共享,并且可以在ubuntu中安装linux下的服务,这样就有可更多可能

jenkins结合windows 2019 server系统的wcl子系统ubuntu通过rsync传送代码到windows中

标签:mit   windows   and   mkdir   arc   ror   ble   mod   重启   

原文地址:https://www.cnblogs.com/reblue520/p/13693429.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!