您的位置:首页 > 其它

对于ubuntu的使用和环境的初始化

2015-04-22 11:29 239 查看
将两个文件从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) mkdir shared (这个语句要在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


———————————————

1.将虚拟机里面的东西在自己的windows电脑上显示出来:

1)首先得先知道我虚拟机的地址,因为是虚拟机,所以ip地址和我本地的是不同的,就因为这样我才能读取到那个ip的东西。




通过在linux环境下使用ifconig获取虚拟机的ip,然后在自己的电脑上的hosts文件里将这个ip加进去




这样就能在自己本地的浏览器上访问这个站点了。




2. 文件.framework是drupal 6以后都需要的文件。

3.访问注册页面,发现里面的textfield没有显示出来,查询f12发现是图片没有加载,说明是缺少权限




所以直接给www-onetouchla-com 这个文件夹赋予777的权限,




通过chmod 的语句对其进行赋权。-R的作用表示递归,逐级赋予权限的意思,这个会在很多地方用到。

这个弄完后还需要清除缓存



4.在windows里连接虚拟机里面的mysql数据库

使用sqlyog,然后file->new connection

然后点击new,输入名字,如我输入了onetouchla,然后在host address中输入我虚拟机的ip地址。然后username,password等的一些信息写进去。弄完了然后点击connect就好了。



———————————————

在虚拟机里面挂载

sudo mount -t vboxsf jnj /var/www/www_onetouchla_com (注意:不能直接挂载到www目录下,因为www下面本来就有很多挂载的东西了,如果挂载到这个目录,可能会直接影响之前的挂载)

jnj这个参数对应的是你windows上面的目录,对应下图的那个地址




然后后面的www_onetouchla_com对应的是linux里面的那个文件的文件名
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: