- 将两个文件从ubuntu的桌面移到 /etc/apache2/site-available 下
Linux Guidelines
2) Install Virtualbox
3) Open Virtualbox
4) Click on Machine->Add
5) Open Ubuntu 13.04.vbox file from the VM folder that you downloaded in step 1)
首先是去\nas\temp\jaguar 下载ubuntu,这是别人本来弄好的,是临时分享的而已。
是点击machine->new ,来新建一个虚拟机
然后下一步,到这个选择hard drive的时候,找到我下过来的ubuntu的备份,然后选取厘米那的.vdi文件,这样就能自动安装好了,双击就能运行这个文件了。
运行成功的情况。
User: ciandt
Pass: $ciandt123
这个是你使用sudo语句所需要使用到的。
2.3 How to configure an environment
There is a symbolic link in /var/www that links to /home/ciandt/www folder.
1) Download filesystem from your project and decompress it in /home/ciandt/www folder.
2) Create a file (as super user) /etc/apache2/sites_available/www_onetouch_com.
$ sudo vim /etc/apache2/sites_available/ www_onetouch_com
3) Use this example that was created for www_jom_com. Replace www_jom_com and jom by your sitename.
4) Edit /etc/hosts and add local.yoursite.com to point to your localhost. This file is very similar to hosts file in Windows.
用终端打开 /etc目录下的hosts文件。然后将127.0.0.1设置成你想要的网址。
加上红色方框内的语句。
这个就是bala写好的两个文件放到/etc/apache2/sites-available目录下,然后后面的那几句是启用或者禁止一些文件,a2ensite这个是启用文件 ,a2dissite是disable文件。然后sudo service apache2 reload重启。
Put these two files under your linux vm. /etc/apache2/sites-available. Assuming you downloaded to /home/ciandt/Downloads/
?sudo cp /home/ciandt/Downloads/www_onetouchla_com* /etc/apache2/sites-available/
? Create a folder
?mkdir -p /home/ciandt/www/www_onetouchla_com
? Run below to enable the sites
?sudo a2ensite www_onetouchla_com
?sudo a2ensite www_onetouchla_com-ssl
?sudo a2dissite default
?sudo a2dissite www_jom_com
?sudo service apache2 reload
7) Upload the database to your MySQL. You can use MySQL Workbench or command line. I suggest to use command line:
$ mysql -h localhost -u root
mysql> drop schema www_yoursite_com
mysql> source database_dump.sql
第七步因为没有数据库没有做
8)在虚拟机的firefox中,打开如下url: local-onetouchla-com.citdev正常打开情况如下:
如果在之前创建的那个文件夹下创建一个index.html的话就会显示那个html的信息。
/home/ciandt/www/www_onetouchla_com
9) Access your site from your host(下面这个图是在在virtual box里面的machine->setting里设置的)
bala的那个attached to 是选择的桥接,而我是选择的NAT,也能成功,在那个Port Forwarding里面,写入两个端口,一个是80,一个是443.
1.Configure Port Forwarding
2.Edit /etc/hosts and add local.yoursite.com to point to 127.0.0.1
10) Access the mysql from localhost(未实现)
1. mysql -h localhost -u root
mysql>GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ WITH GRANT OPTION; mysql>FLUSH PRIVILEGES;
2. sudo vim /etc/mysql/my. cnf
Find #bind-address = 127.0.0.1 //Cancellation this line
3. sudo service mysql restart
2.4 Hacked module(未实现)
https://docs.google.com/a/ciandt.com/document/d/1cQX_iIe3p7Ao7GD16yLtTXVe6cq2YIZEgEOGJmijzvc/edit
2.5 Sharing folders between Windows and VM
1.ox
点击 Devices→ Shared folders…
3. choose your folder in Windows that will be shared.
4.On your Virtual Machine, open terminal, create a folder and mount the shared folder:
mkdirshared(这个语句要在root目录下运行,即进去后先输入cd) sudo mount -t vboxsf jnj /home/ciandt/shared
jnj → it is the folder name that you entered in Step 3.
/home/ciandt/shared → it is the folder that you created in step 4.
备注:共享的话,
1.首先在我自己的windows系统上创建一个文件夹,如我在桌面创建了一个jnj的文件夹。
2.然后在ubuntu上创建一个shared的目录,如我是在目录/home/ciandt/下创建的shared文件夹,可以使用代码$ mkdir shared (这个语句要在root目录下运行,即进去后先输入cd)。
3.然后点击进入vm里面Devices/Shared Forders Settings
4.然后进入这个设置的方框,按如下填写信息,即找到你在windows下建立的那个要共享的文件夹,然后记得将Auto-mount和Make Permanent勾上。
5.这样其实这个文件共享就做好了,剩下的就是要建立一个软连接,把shared目录映射到我开发的环境下。
使用ln语句,前面的目录是你要建立软连接的共享对象,后面的目录是你要创建快捷方式的地方。
ps:
错误信息记录
如图,这个的错误信息就是没有这个目录,要做的就是把最后一个/去掉
这个错误是目标文件是只读文件。所以判断原因是文件目录写反了
5./home/ciandt/shared is a shared folder that you can use to copy and paste between your Host and the VM.
2.6 Possible issues
1.If you have UUID issues in your Virtual HD, use the following command in cmd:
C:\virtualbox\ubuntu> ‘C:\Program Files\Oracle\VirtualBox\VBoxManage.exe’ internalcommands sethduuid ubuntu.vdi
2.For forbidden issues when you try to access your site, try to change the permissions of your folder:
$ chmod -R 755 ~/www/yoursite
$ chmod -R 777 ~/www/yoursite/sites/default/files