linux使用--ubuntu使用记录

1550阅读 0评论2014-05-10 lujian19861986
分类:LINUX

一. 系统设置
二. 常用软件安装及设置及配置
三. ubuntu下各种服务安装
四. 网络配置
五. ubuntu 下各种乱码问题的解决
六. 老版本ubuntun


一. 系统设置
1.1 调整时区
  1. root@ubuntu:~# dpkg-reconfigure tzdata
1.2 ubuntu 地址栏显示完整路径
  1. Alt+F2: gconf-editor -->apps-->nautilus-->preferences-->选中always_use_location_entry
1.3 ubuntu x windows与命令行切换
  1. root@ubuntu:~# /etc/init.d/gdm stop     #彻底停止x window
  2. root@ubuntu:~# /etc/init.d/gdm restart  #启动x window
1.4 修改终端terminal的大小
  1. Edit --> profile --> Default --> General -> 最下方的Use customer Default size
1.5 将按钮设置在右侧
  a. ubuntu 12.04
  1. a. 在终端下sudo apt-get install gconf-editor ;首先安装gconf-editor
  2. b. Ctrl+Alt+T调出终端,运行:gconf-editor,打开“配置编辑器”
  3. c. 找到 /app/metacity/general",把 “button_layout" 的值改为 ”menu:minimize,maximize,close“
  b. ubuntu 13.04
  1. gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"
1.6 取消边缘自动最大化
a. ubuntu 12.04
  1. cong@msi:/tmp$ sudo apt-get install gconf-editor
  a. 在gconf-editor中,依次打开 /apps/compiz-1/plugins/grid/screen0/options/
  将右侧所有以 _action结尾的选项都设为0,就可以取消所有的边缘自动最大化
b. ubuntu 14.04  
  1. cong@msi:/tmp$ sudo apt-get install compizconfig-settings-manager
a. 在system tools --> preference 中找到compizConfig Settings
b. 打开compizConfig Settings, 左侧选window Management, 右侧选grid
c. grid--> corners/Edges --> 中下面所有的都改为NONE

1.7关闭openoffice的扩展提示
  1. 在openoffice中鼠标移动时会出现一个黄色的提示框,想去掉可以这样:  
  2.     Tools --> Options-->General  
  3.         去掉 Tips 前的勾
1.8 系统查看
 a. 查看ubuntu 的版本号
  1. root@ubuntu:~# cat /etc/issue
  2.         Ubuntu 9.04 \n \l
b. 查看 ubuntu 系统
  1. root@ubuntu:~# lsb_release -a
  2.     No LSB modules are available.
  3.     Distributor ID: Ubuntu
  4.     Description: Ubuntu 9.04
  5.     Release: 9.04
  6.     Codename: jaunty
1.9 新建用户
ubuntu 下新建用户直接用: adduser user1
这就在/home/下自动建好了主目录等,很简单也很方便
1.10 屏蔽insert键
  1. 1. #xev 查看insert键的keycode(如:118)
  2. 2. #xmodmap -pke > ~/.xmodmap
  3. 3. #vi ~/.xmodmap 将该行改为 keycode 118 =
  4. 4. #xmodmap -e "clear Lock"
  5. 5. #xmodmap ~/.xmodmap
  6. [转自]http://blog.163.com/xuhong@yeah/blog/static/640870092010101291738122/


二. 常用软件安装及配置
2.1 安装apt-fast加速下载过程
  1. 下载 apt-fast.sh:
  2. root@ubuntu:~# wget http://www.mattparnell.com/linux/apt-fast/apt-fast.sh
  3. 把它移动到 /bin 目录中同时改名为 fast,
  4. root@ubuntu~# cp apt-fast.sh /bin/fast
  5. root@ubuntu~# chmod 777 /bin/fast
  6. 以后用apt-get的时候就换成fast
  7. []http://lifehacker.com/#!5783314/apt+fast-speeds-up-package-downloads-in-ubuntu
2.2.安装适合Ubuntu低版本的源
  1. root@ubutnu:/etc/apt# lsb_release -a ;查看当前系统版本
  2. root@ubuntu:/etc/apt# gedit /etc/apt/source.list ;修改源,添加如下两行
  3. deb http://old-releases.ubuntu.com/ubuntu/ jaunty main restricted
  4. deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty main restricted
  5. root@ubuntu:/etc/apt# apt-get update ;更新源
  6. []http://billgateshxk.blog127.fc2blog.net/blog-entry-261.html
2.3.dos2unix 的安装
  1. root@ubuntu:~# apt-cache search dos2unix
  2. 找出来的是 tofrodos, 安装之后就有了unix2dos dos2unix这个命令
  3. root@ubuntu:~# apt-get install tofrodos4
2.4.man ubuntu 的安装
  1. root@ubuntu:~# apt-get install manpages ;己安装
  2. root@ubuntu:~# apt-get install manpages-dev
2.5 使用cairo-dock告别unity      
  1. sudo apt-get install cairo-dock
重启后,在登陆里面选择cario-dock
a. opengl 与非opengl切换
    当使用opengl时 cairo-dock会有黑边, 这时候切换成不使用opengl就可以了。
    但是己经设置了记住使用opengl怎么办呢?
     //删除cairo-dock的配置文件就可以了
    cong@msi:~$ rm ~/.config/cairo-dock/.cairo-dock  
b. cairo-dock有黑边
    a. 使用opengl 切找到使用非opengl
    b. 如果还不行,只能换个ubuntu的版本了,由12.04换成14.04之后没有出现过这个问题

2.6 在ibus中使用极点五笔
  1. 下载: http://nick.txtcc.com/nickfiles/vissible-ibus.tar.gz
  2. cong@dell:~/Downloads$ tar xf vissible-ibus.tar.gz
  3. cong@dell:~/Downloads$ sudo mv ./vissible.db /usr/share/ibus-table/tables/
  4. cong@dell:~/Downloads$ sudo mv ./vissible.gif /usr/share/ibus-table/icons/
2.7 fcitx的安装及使用
  1. cong@msi:~$ sudo apt-get install fcitx
a. 安装五笔拼音
cong@msi:~$ sudo apt-get install fcitx-table-wbpy
b. 按enter后的动作
configure --> Global Config --> Output --> Action after press enter --> 由commit改为nothing
c. ubuntu14.04
好像直接apt-get install 之后没有码表,所以要先安装
  1. cong@msi:~$ sudo apt-get install fcitx-table、fcitx-table-wubi、fcitx-table-wbpy
d.添加输入法
   打开fcitx的配置: 在system tools--> preference --> fcitx configuration
   在input Method标签下面有个+的按钮,点一下会出现"Add Input Method"
   去掉"only show current Languager",在search中输入wubi, 点ok,就添加上
2.8 wine + source insight
  1. sun@ubuntu:~$ sudo apt-get install wine //wine的安装很简单
安装wine之后,找到source insight的安装文件exe的那个,右键打开方式为wine,剩下的和win一样。
    source insight用的字体fixsys需要到下面的网站下载:
    />     ***celsior.com/
    把下载的字体拷贝到系统/usr/share/fonts/truetype/freefont下面就可以了。
a. sourceinsight的启动脚本
  1. #!/bin/sh
  2. wine "C:\Program Files (x86)\Source Insight 3\insight3.exe" 1>/dev/null 2>&1 &
    推荐用 "WenQuanYi Micro Hei Mono"这个字体,感觉效果不错
2.9  google angent
  a. 首先安装python的开发包,
否则会出现: gevent/gevent.core.c:5:20: fatal error: Python.h: No such file or directory   
  1. root@ubuntu:~# apt-get install python-dev
  2. root@ubuntu:~# curl -k -L http://git.io/I9B7RQ|su
  b. goagant的启动脚本
  1. #!/bin/sh
  2. python /home/cong/bak/soft/proxy/goagent-v3.1.5/local/proxy.py 1>/dev/null 2>&1 &
c. 出错
c.1 Your client does not have permission to get URL /2 from this server.  That’s all we know.
        需要把goagent-3.0.4/local/proxy.ini中的profile一栏由 google_cn改为
        profile = google_hk,然后重启goanget就可以了。
2.10  chrome
  a.安装 google-chrome-stable_current_i386.deb 后出现以下提示
"Please start Google Chrome as a normal user. To run as root, you must specify an alternate --user-data-dir for storage of profile information."
b. 解决方法如下:
  1. root@ubuntu:~# cd /opt/google/chrome ;进入chrome的安装目录
  2. root@ubuntu:/opt/google/chrome# vi ./google-chrome
  3.  将 exec -a "$0" "$HERE/chrome" "$@"
  4.  改为 exec -a "$0" "$HERE/chrome" %U --user-data-dir=/root/.config/chromium/
  5. root@ubuntu:/opt/google/chrome# mkdir -pv /root/.config/chromium/ ;创建个人资料的存储目录
  6. []: http://www.2cto.com/os/201107/95197.html
2.11 更新firefox
2.12 为firefox添加flash插件
  1. 打开 http://get.adobe.com/cn/flashplayer/ 在 “选择要下载的版本” 中选择 tar.gz
  2. cong@dell:~/Downloads$ tar xf install_flash_player_11_linux.x86_64.tar.gz //下载后解压,生成 usr目录和一个库
  3. cong@dell:~/Downloads$ sudo mv ./libflashplayer.so /usr/lib/mozilla/plugins/ //将库和目录分别cp
  4. cong@dell:~/Downloads$ sudo cp -r usr/* /usr
  5. : 如果没有/usr/lib/mozilla/plugins/目录就试一下/usr/lib/firefox/plugins/目录
2.13  minicom的配置
  1. ubuntu 10.04 自带有minicom, 而且己装好usb驱动
  2. 只需要配置一下即可
  3.   # minicom -s
  4.   Serial port setup
  5.   Serial Device : /dev/ttyUSB0
  6.   注: usb转串口-->/dev/ttyUSB*
  7.      直接用串口-->/dev/ttyS*
2.14 星际译王的安装
  1. a. cong@dell:/work/$ sudo apt-get install stardict
  2. b. 到http://abloz.com/huzheng/stardict-dic/zh_CN/ 下载需要的词库。
  3. c. cong@dell:~/Downloads$ tar xf stardict-ncce-ec-2.4.2.tar.bz2 //解压词库
  4.    //并将词库放在相应的目录下, 将解压出来的目录直接拷贝到/usr/shard/stardict/dic下就可以了
  5. d. cong@dell:~/Downloads$ sudo mv ./stardict-ncce-ec-2.4.2 /usr/share/stardict/dic/
2.15 获取源代码
realpath这个命令,我想看一下它的源代码:
  1. cong@msi:/work/test$ sudo apt-cache showsrc realpath      //a.查看有没有这个源码包
  2. Package: realpath
  3. Binary: realpath
  4. Version: 1.19
  5. ...
  6. Files:
  7.  0cda9c476967f2daf26dda0952aced06 899 realpath_1.19.dsc      -->查找到了这么几个文件
  8.  0c7207efe854b0347f49fad3d709cc3b 17160 realpath_1.19.tar.gz
  9.  
  10. cong@msi:/work/test$ sudo apt-get source realpath          //b.查看有没有这个源码包     
  11. ...
  12. dpkg-source: info: extracting realpath in realpath-1.19    //c.dpkg-source会解压
  13. dpkg-source: info: unpacking realpath_1.19.tar.gz

  14. cong@msi:/work/test$ ls                                    //d.源码包会在当前目录下找到
  15. realpath-1.19 realpath_1.19.dsc realpath_1.19.tar.gz

  16. cong@msi:/work/test/busytest/11realpath$ tree ./realpath-1.19//3.看一下.c文件,呵呵
  17. ./realpath-1.19/
  18. ├── common.mk
  19. .....
  20. └── src
  21.     ├── Makefile
  22.     └── realpath.c

  23. 7 directories, 26 files




三.ubuntu下各种服务安装
  telnet, ssh, samba, nfs, vsftp, tftp
  1. 3.1 Ubuntu下实现Telnet服务  
  2.     a.安装: apt-get install openbsd-inetd
  3.     b.配置: /etc/inetd.conf 中添加
  4.           telnet stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.telnetd
  5.     c. 启动: /etc/init.d/openbsd-inetd restart
  6.     d. 查看telnet服务是否启动
  7.                netstart -a | grep telnet   
  8.               tcp 0 0 *:telnet *:* LISTEN
  9.     e. 测试: telnet localhost
  10. 3.2 ssh ubuntu 安装
  11.     a. 安装ssh-server root@ubuntu: # apt-get install openssh-server
  12.     b. 确认sshserver是否启动root@ubuntu: # ps -e |grep ssh
  13.     c. 重启ssh: root@ubuntu: # /etc/init.d/ssh restart
  14. 3.3 samba ubuntu 安装
  15. a. 安装: root@ubuntu: # apt-get install samba
  16. b. 添加用户: root@ubuntu: # smbpasswd -a
  17. c. 修改smb.conf,共享/
  18. [global]
  19.     workgroup = WORKGROUP
  20.     printing = cups
  21.     printcap name = cups
  22.     printcap cache time = 750
  23.     cups options = raw
  24.     include = /etc/samba/dhcp.conf
  25.     logon path = \\%L\profiles\.msprofile
  26.     logon home = \\%L\%U\.9xprofile
  27.     logon drive = P:
  28. #    usershare allow guests = Yes
  29.     domain logons = Yes
  30.     domain master = Yes
  31.     local master = Yes
  32.     os level = 65
  33.     preferred master = Yes
  34.     null passwords = yes
  35.     security = share
  36.     guest ok = yes
  37.     usershare max shares = 100
  38.     security = user
  39.     encrypt passwords = yes
  40.     smb password file = /etc/samba/smbpasswd
  41. [rootfs]
  42.     comment = rootfs
  43.     inherit acls = Yes
  44.     path = /
  45.     read only = No
  46. d. windows登陆并记住密码之后,要清除
  47.      在windows 的cmd下输入: net use * /del /y
  48. 3.4 nfs ubuntu 安装
  49. a. 安装nfs: root@ubuntu: # apt-get install nfs-kernel-server
  50. b. 安装nfs客户端: root@ubuntu: # apt-get install nfs-common
  51. c. 配置文件/etc/exports,添加如下一行
  52.     /nfs/share/ *(rw,sync,no_subtree_check,no_root_squash,insecure)
  53. d. 启动NFS: root@ubuntu: # /etc/init.d/nfs-kernel-server start
  54. 3.5 vsftpd安装
  55. a. 安装apt-get install vspftpd
    b. 关闭匿名,打开写权限
    c. 添加系统用户密码,设置为ftp组,主目录
    d. root@ubuntu:~#  useradd -m -d /home/ftp  -G ftp ftproot 
    添加一个 ftproot 用户,指定家目录为/home/ftp ,同时加入ftp组 
    e.设置密码:  root@ubuntu:~# passwd ftproot 
    3.6 tftp安装
    a. root@ubuntu:~#  apt-get install tftpd tftp openbsd-inetd ;安装
    b. root@ubuntu:~#  vi /etc/inetd.conf ;配置tftp文件路径
                tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tmp
    c. root@ubuntu:~# chmod 777 /tmp
    d. root@ubuntu:~# /etc/init.d/openbsd-inetd restart ;重启服务,使配置生效
       root@ubuntu:~# netstat -an | grep 69 ;查看69端口是否打开
       root@ubuntu:~#  tftp 192.168.1.2  ;tftp 本机ip测试一下
       tftp> get test.txt
    注意: /root不可以作为tftp根目录

. 网络设置
4.1 ubuntu 10.10 下将dhcp改为staic的方法
 vi /etc/network/interface
  1. # This file describes the network interfaces available on your system
  2. # and how to activate them. For more information, see interfaces(5).

  3. # The loopback network interface
  4. auto lo
  5. iface lo inet loopback

  6. # The primary network interface
  7. #auto eth0
  8. #iface eth0 inet dhcp
  9. auto eth0
  10. iface eth0 inet static
  11. address 192.168.1.249
  12. netmask 255.255.255.0
  13. network 192.168.1.0
  14. broadcast 192.168.1.255
  15. gateway 192.168.1.1
发现ifconfig eth0 down 和 ifconfig eth0 up不管用,可以用必杀技----重启系统
但是还有更简单的方法  $ sudo /etc/init.d/networking restart
4.2 取消ADSL
修改interfaces文件如下:
sudo vi /etc/network/interfaces
  1.   1 # This file describes the network interfaces available on your system
  2.   2 # and how to activate them. For more information, see interfaces(5).
  3.   3
  4.   4 # The loopback network interface
  5.   5 auto lo
  6.   6 iface lo inet loopback
  7.   7
  8.   8 auto eth0
  9.   9 iface eth0 inet dhcp
4.3 ping 百度出现unknown host
查看 /etc/resolv.conf看是否有nameserver xx.xx.xx.xx
如果没有就添加:    nameserver  8.8.8.8
但是重启后就没有了, 掉电不失的文件在
/etc/network/interfaces中添加就可以了.
dns-nameservers 8.8.8.8
 
4.4  换网卡后ifconig失败
主板上集成的网卡坏了,换了一个rtl8139的pci网卡,进入win7下一切正常,
但是切换到ubuntu12.04下ifconfig总是失败
  1. cong@msi:~$ sudo ifconfig eth0 up
  2. eth0: ERROR while getting interface flags: No such device
解决方法:
  1. rm /etc/udev/rules.d/70-persistent-net.rules
/etc/udev/rules.d/70-persistent-net.rules下面add的记录是集成网卡的mac地址
把这个文件删掉,然后重启系统就可以就pci网卡了
5.5  查看网卡驱动是否安装
  1. cong@msi:~$ lspci | grep "net"
  2. 04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)


五. ubuntu 下各种乱码问题的解决

  1. a. 将ubuntu 中文界面改回英文界面的方法
  2. root@ubuntu:~# vim /var/lib/locales/supported.d/local
    改成:  en_US.UTF-8 UTF-8
    root@ubuntu:~# vim /etc/default/locale
    将下面的内容修改
        LANG="zh_CN.UTF-8"
        LANGUAGE="zh_CN:zh"
    修改为:
        LANG="en_US.UTF-8"
        LANGUAGE="en_US:en"
    root@ubuntu:~# locale-gen 
  3. 重启系统之后,英文显示,不再出现乱码。
    b. 解决ubuntu自带Document Viewer看中文pdf乱码问题
  4. sudo apt-get install poppler-data
  5. [转]http://blog.sina.com.cn/s/blog_5752764e0100i3a4.html

  6. c.ubuntu默认是打不开rar文件的,所以我就安装了rar 和unrar,在终端运行
  7. sudo apt-get install rar unrar
  8. 安装后我解压了一个内容为中文文件的rar文件,发现里面全是乱码,怎么办发现是rar的问题,这样我们就卸载rar只留下unrar在终端运行
  9. sudo apt-get autoremove rar
  10. 好了这回打开rar文件不是乱码了。
  11. [转]http://blog.sina.com.cn/s/blog_60946c8e0100t2kf.html

  12. d. 英文版系统,在安装chrome时,会将编码设置成别的,
  13. d.1 所以你需要的就是设置chrome显示的字体和编码
  14. preferences--> Under the Hood --> Web Content --> Customize fonts..
  15. 设置 Encoding 为 Chinese Simplified (gb18030)
  16. [转]
  17. d.2 chrome标签乱码
  18.    sudo vi /etc/fonts/conf.d/49-sansserif.conf
  19.     将倒数第四行的
    1. <edit name="family" mode="append_last">
    2.      <string>sans-serif</string>
    3. </edit>
    改为
    1. <edit name="family" mode="append_last">
    2.       <string>simsun</string>
    3. </edit>
  20. e.解决gedit乱码
  21. 缺省配置下,用 Ubuntu 的文本编辑器(gedit)打开 GB18030/GBK/GB2312 等类型的中文编码文本文件时,将会出现乱码。
    出现这种情况的原因是,gedit 使用一个编码匹配列表,只有在这个列表中的编码才会进行匹配,不在这个列表中的编码将显示为乱码。您要做的就是将 GB18030 加入这个匹配列表。
    $ gconftool-2 --set --type=list --list-type=string /apps/gedit-2/preferences/encodings/auto_detected "[UTF-8,CURRENT,GB18030,BIG5-HKSCS,UTF-16]"
    ubuntu 12.04下: 
    $ gsettings set org.gnome.gedit.preferences.encodings auto-detected "['GB18030','GB2312','GBK','UTF-8','BIG5','CURRENT','UTF-16']"
    $ gsettings set org.gnome.gedit.preferences.encodings shown-in-menu "['GB18030', 'GB2312', 'GBK', 'UTF-8', 'BIG5', 'CURRENT', 'UTF-16']"
    f.解决ubuntu 下 wget 中文乱码的问题
    使用wget-1.12时出现乱码,google,需要重新编译源码,步骤如下:
    f1. 修改代码如下:   
    1. 将src/url.c L1294的
    2. #define FILE_CHAR_TEST(c, mask) \
    3.     ((opt.restrict_files_nonascii && !c_isascii ((unsigned char)(c))) || \
    4.     (filechr_table[(unsigned char)(c)] & (mask)))

    5. 改为:
    6. #define FILE_CHAR_TEST(c, mask) \
    7.     (((opt.restrict_files_nonascii && !c_isascii ((unsigned char)(c))) || \
    8.     (filechr_table[(unsigned char)(c)] & (mask)))\
    9.     && !((c|0x0fffffff) == 0xffffffff))
    10. 记得 opt 前加 "("
    f2. 编译之前需要先安装以下库
         apt-get install openssl
         apt-get install libssl-dev
    否则会出现以下错误:
    configure: error: openssl development libraries not found
    f3.    ./configure --with-ssl=openssl --prefix=/opt/wget-1.12/install
           需要指定 --with-ssl=openssl, 否则会出现以下错误:
           configure: error: --with-ssl was given, but GNUTLS is not available.
    f4. make && make install 



六. 老版本ubuntu的使用
1. 替换源/etc/apt/sources.list为如下
  1. deb http://old-releases.ubuntu.com/ubuntu/ lucid main restricted
  2. deb-src http://old-releases.ubuntu.com/ubuntu/ lucid main restricted

  3. deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates main restricted
  4. deb-src http://old-releases.ubuntu.com/ubuntu/ lucid-updates main restricted

  5. deb http://old-releases.ubuntu.com/ubuntu/ lucid universe
  6. deb-src http://old-releases.ubuntu.com/ubuntu/ lucid universe
  7. deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates universe
  8. deb-src http://old-releases.ubuntu.com/ubuntu/ lucid-updates universe

  9. deb http://old-releases.ubuntu.com/ubuntu/ lucid multiverse
  10. deb-src http://old-releases.ubuntu.com/ubuntu/ lucid multiverse
  11. deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates multiverse
  12. deb-src http://old-releases.ubuntu.com/ubuntu/ lucid-updates multiverse

  13. deb http://old-releases.ubuntu.com/ubuntu lucid-security main restricted
  14. deb-src http://old-releases.ubuntu.com/ubuntu lucid-security main restricted
  15. deb http://old-releases.ubuntu.com/ubuntu lucid-security universe
  16. deb-src http://old-releases.ubuntu.com/ubuntu lucid-security universe
  17. deb http://old-releases.ubuntu.com/ubuntu lucid-security multiverse
  18. deb-src http://old-releases.ubuntu.com/ubuntu lucid-security multiverse
即把sources.list中的us.archive替换为old-releases
然后sudo apt-get update
2. 搭建gcc编译环境
  1. cong@cong:~$ sudo apt-get install ia32-libs
  2. cong@cong:~$ sudo apt-get install build-essential module-assistant
  3. cong@cong:~$ sudo apt-get install gcc-multilib g++-multilib


上一篇:LINUX多路复用select,poll,epoll
下一篇:linux下双向链表的实现