基于OA网络的Ubuntu9.04工作环境配备

基于OA网络的Ubuntu9.04工作环境配置
    在外网环境下Ubuntu应该很好配置,但是在OA网络的话,需要设置一些比较繁琐的步骤。
这里我简单写了几个步骤:

首先是跟上网无关的,那就是设置中文输入环境:

    1.在CDROM中插入Ubuntu CD,在Ubuntu面板上选择“System->Administration->Software
      Sources”,然后选中“Installable from CD-ROM/DVD”

    2.选择“System->Administration->Language Support”,选中“Use input
      method...”然后单击“Install/Remove Languages...”,Choose "Chinese" and
      then apply.

    3.“System->Preferences->SCIM Input Method Setup”,在“Global Setup”中,
      你会看到中文输入法,设置Hotkey,重启即可。

接下来是设置Office网络:

    1.“System->Preferences->Network Connections”,在“Wired”tab中编辑
      Connection,“802.1x Security”Authentication选择Protected EAP(PEAP),
      里面选项选择“MSCHAPV2”,然后输入你的User name以及Passwd
      (和你Windows中的OA Account一致)

接下来设置Internet Proxy,有两个,一个是Firefox,另一个是Terminal:

    Firefox:“Edit->Preference->Advanced->Network”,选择“Settings...”,
               然后设置Http Proxy(根据你公司的网络)

    Terminal:这一步,我们需要cntlm这个插件,如附档。
              安装cntlm,然后“sudo gedit /etc/cntlm.conf”,修改Username, Domain,
              Password和Proxy;
              编辑完后,运行“sudo cntlm -f -v”
              最后“System->Preferences->Network Proxy”,选中“Manual proxy
              configuration”,HTTP Proxy输入127.0.0.1, Port输入3128
              然后按下“Apply System-Wide...”

              这些设置完后,可以试下“sudo apt-get update”

做完上面这些设置后,你应该就可以通过Proxy上OA网络,而且可以apt-get了。

补充:内网ssh代理
     使用corkscrew    sudo apt-get install corkscrew
     修改用户目录下的.ssh/config文件,正常情况下没有config文件

      Host *
             ProxyCommand corkscrew http-proxy.example.com 8080 %h %p


I  successfully 'GIT' android source through http proxy. Here is my
steps:

Download a tool  corkscrew  from http://www.agroman.net/corkscrew/

tar zxvf  corkscrew-2.0.tar.gz
cd corkscrew-2.0
./configure
make
cp corkscrew ~/bin  # or to any directory in your $PATH


Create a  shell script named 'git-proxy' in ~/bin, include following
content:
#!/bin/sh
exec ~/bin/corkscrew <proxy name> <proxy port> $*


Replace ~/bin/ and <...> with your own information.

and then run following command:
git config --global core.gitproxy '~/bin/git-proxy' 


========================================================
有可能会出现如下错误
Getting repo ...
   from git://android.git.kernel.org/tools/repo.git
fatal: exec ~/bin/git-proxy failed.
fatal: The remote end hung up unexpectedly


解决办法:
1. make sure your git-proxy has x attribute: chmod +x git-proxy.
2. make sure your git-proxy is correct.
3. try replace ~/bin with the absolute path.

===========================================================
还有一个工具

   1.  Install socat. For example, on Debian/Ubuntu, just sudo apt-get install socat.
   2. Create a script called gitproxy in your bin directory;

      #!/bin/sh
      # Use socat to proxy git through an HTTP CONNECT firewall.
      # Useful if you are trying to clone git:// from inside a company.
      # Requires that the proxy allows CONNECT to port 9418.
      #
      # Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
      # chmod +x gitproxy
      # git config --global core.gitproxy gitproxy
      #
      # More details at http://tinyurl.com/8xvpny

      # Configuration. Common proxy ports are 3128, 8123, 8000.
      _proxy=proxy.yourcompany.com
      _proxyport=3128

      exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport

      view raw gitproxy-socat This Gist brought to you by GitHub.
      You will need to replace proxy.yourcompany.com with the name of your proxy host and the port with the port used by the proxy (common ports include 3128, 8123 and 8000). (If the javascript is broken, visit Gist 49288 and download the raw file; or use the original commands as reproduced in the comments.)
   3. Configure git to use it:

      $ git config --global core.gitproxy gitproxy

按照上面的两种方法,我设置git proxy依旧没有能够成功:(
这里,我再介绍我成功设置git proxy的第三种办法
使用socket
step如下:

1 sudo apt-get install socket
2 在你的home/allen/bin(这个在$PATH中)下创建脚本 "proxy-cmd.sh"
#! /bin/bash
(echo "CONNECT $1:$2 HTTP/1.0"; echo; cat ) | socket YOUR_PROXY
YOUR_PROXY_PORT | (read a; read a; cat )
3 chmod +x proxy-cmd.sh
4 export GIT_PROXY_COMMAND=<PATH TO YOUR SCRIPT>/proxy-cmd.sh

这里你可以在~/.bashrc中export GIT_PROXY_COMMAND,就没有必要每次都export了。

至此,你就可以repo init了。

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
怎样远程连接windows share folder
除了ubuntu自带的connect to server外,还有一种办法:

#!/bin/sh
sudo mount //10.193.77.93/FreeShare /mnt/share/ -o iocharset=utf8,username=wjrt87,password=123,dmask=777,fmask=777,codepage=cp936,uid=0