欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Ubuntu共享Windows下Xampp的htdocs和数据库目录

视频教程-使用localize.drupal.org和poedit汉化Drupal

Ubuntu共享Windows下Xampp的htdocs和数据库目录

无须猫 的头像
1条评论发表评论N/AAttribution

Ubuntu菜鸟,如有不对之处请指出,谢谢:)

1. 把windows分区挂载到ubuntu下

参考文章:自动挂载 Windows 分区
http://wiki.ubuntu.org.cn/%E8%87%AA%E5%8A%A8%E6%8C%82%E8%BD%BDWindows%E5...

1.1 自动挂载 windows 分区执行下列命令, 编辑挂载脚本 autowinfs.

sudo gedit /usr/sbin/autowinfs

1.粘贴下面到内容,保存退出。

mkdir  -p  /windows/
rmdir   /windows/*   1> /dev/null
grep  -v  '/windows/'  /etc/fstab  >  /etc/fstab.swp
fdisk  -l /dev/[hs]d[a-z]  |  grep     'NTFS'  | cut -d' ' -f1    |   cut -d/ -f3  |   while read WDISKS
do echo  "/dev/$WDISKS  /windows/$WDISKS  ntfs  auto,user,nls=utf8,umask=0   0 0"    >>  /etc/fstab.swp
mkdir  "/windows/$WDISKS"
done
fdisk  -l /dev/[hs]d[a-z]  |  grep     'FAT'  | cut -d' ' -f1    |   cut -d/ -f3  |   while read WDISKS
do echo  "/dev/$WDISKS  /windows/$WDISKS  vfat  auto,user,utf8,umask=0   0 0"    >>  /etc/fstab.swp
mkdir  "/windows/$WDISKS"
done
mv   /etc/fstab.swp    /etc/fstab
mount   -a
exit  0

1.3 再运行命令:

sudo chmod +x /usr/sbin/autowinfs
sudo /usr/sbin/autowinfs

就可以了,Windows分区将挂载在 /windows/ 下

2. 共享win分区下到xampp文件夹

参考文章:window和ubuntu共用web和mysql数据目录 http://www.xiaogua.name/?post=3

ps.修正了原文的一些笔误,并按照我的实际情况做了些修改。

win下我的xampp装在“e:/xampp“,而ubuntu下e盘挂载于“/windows/sda6“。

2.1 共享htdocs目录

修改httpd.conf

$ gedit /opt/lampp/etc/httpd.conf

DocumentRoot "/opt/lampp/htdocs"改为DocumentRoot "/windows/sda6/xampp/htdocs"

2.2 共享mysql数据库

删除mysql目录

$sudo rm -rf /opt/lampp/var/mysql

创建符号链接到xampp的数据目录

$sudo ln -sf /windows/sda6/xampp/mysql/data /opt/lampp/var/mysql

2.3 重启lampp即可

$sudo /opt/lampp/lampp restart

 

普通分类: