配置virtualbox共享文件夹
比如如下图我的配置
- laravel-php 对应 win系统下一个目录
开始准备和centos7.2系统联系
写入开机脚本两种方案
1.逐渐弃用的方案(出于兼容性才保留的)
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
关键文件**/etc/rc.local 和 /etc/rc.d/rc.local **
注意软链接
/etc/rc.local -> rc.d/rc.local
所以前者想要正常开机执行,后者必须给x执行权限
开始追加脚本是append 不是覆盖
mount -t vboxsf laravel-php /var/webwww/
2.centos推荐的自启动脚本
原理通过systemd(centos)来定义一个服务
以开机启动shadowsocks.service为例(国外服务器在给国内翻墙的,你懂的)
首先 /etc/systemd/system下新建文件shadowsocks.service
vim /etc/systemd/system/shadowsocks.service
添加下面代码
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
#关键执行代码
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target
然后玩过centos7.X的小伙伴就熟悉了,
systemctl enable shadowsocks
systemctl start shadowsocks
作为练习,大家自己写成service的形式
安装virtualbox的共享功能
mount /dev/cdrom /mnt
cd /mnt
./VBoxLinuxAdditions.run
如果失败
yum 安装gcc,再安装kernel-devel和kernel-headers
在重复上面就成功了
注:systemctl 在新系统里代替了service 和 chkconfig