CentOS-7-x86_64-Minimal-1708 VMware® Workstation 12 Pro 12.5.6 build-5528349
yum -y install perl gcc make kernel-headers kernel-devel
1. 使用ISO映像文件: C:\Program Files (x86)\VMware\VMware Workstation\linux.iso 2. 勾選已鏈接
linux.iso文件在VMware安裝目錄下找。php
mount /dev/cdrom /mnt cp /mnt/VMwareTools-10.1.6-5214329.tar.gz ~/ cd ~ tar zxvf VMwareTools-10.1.6-5214329.tar.gz cd vmware-tools-distrib/ ./vmware-install.pl
//...一直回車直至出現一下信息表明安裝完畢 To enable advanced X features (e.g., guest resolution fit, drag and drop, and file and text copy/paste), you will need to do one (or more) of the following: 1. Manually start /usr/bin/vmware-user 2. Log out and log back into your desktop session 3. Restart your X session. Enjoy, --the VMware team
umount /mnt
1. 選擇:老是啓用 2. 添加目錄便可
cd /mnt/hgfs ls
設置成功的話,能夠看到共享的文件夾node
windows共享目錄沒法建立軟連接, 有些項目像laravel,node_modules安裝的時候會出現問題。我是經過rsync同步的方式,同步共享目錄裏的項目到另外一個linux目錄下。雖然不是很優雅,可是比較實用
rsync -vzrtopgu --progress /mnt/hgfs/www/blog /srv/projects/
vim /opt/scripts/rsync.php <?php function rsync_projects() { $command = 'rsync -vzrtopgu --exclude=index.php /mnt/hgfs/www/blog /srv/projects/'; $output = []; exec($command , $output); $str = '---------' . date('Y-m-d H:i:s') . '---------' . PHP_EOL; if($output) { foreach ($output as $val) { $str .= $val . PHP_EOL; } } @file_put_contents('/opt/scripts/rsync.log', $str, FILE_APPEND); } rsync_projects();
同步後的項目入口文件index.php開頭處加入linux
require '/opt/scripts/rsync.php';
rsync.php
的同步命令是rsync -vzrtopgu --exclude=index.php /mnt/hgfs/www/blog /srv/projects/
。排除了index.php
laravel
開發項目/mnt/hgfs/www/blog
, 實際運行項目/srv/projects/blog
。每次想要查看修改代碼效果的時候會訪問/srv/projects/blog
入口文件index.php
,同時執行rsync.php
腳本同步文件。這樣作實際上比加到crontab執行或者監測文件變化同步都簡單實用