ubuntu12.04 64bit 常见问题
2014-05-07 12:17
369 查看
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
访问其他samba服务器
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
首先需要安装samba
# apt-get install samba
1. 一种直接使用smbclient命令
# smbclient //服务器地址/目录 -U 用户名%密码
如
# smbclient //192.168.0.133/liyong -U liyong%liyong
2. 使用mount
#apt-get install smbfs
#smbmount //192.168.0.133liyong /mnt/133 -o user=liyong,pass=liyong,iocharset=utf8
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
安装飞信
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sudo apt-get install openfetion
sudo apt-get install pidgin-openfetion
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
android编译环境搭建
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
l 依赖环境:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
安装过程中,我出现了错误1。解决后:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
l 编译
进入源码目录后,执行如下命令:
$ source build/envsetup.sh
$ lunch full-eng
$ make
编译过程中出现了错误2、3、4、5.
l 运行
$ emulator
错误:
1、安装全部库时libc6-dev:i386
错误:
Errors were encountered while processing:
libc6-dev:i386
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@mao-virtual-machine:~# apt-get install libc6-dev:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dev:i386 is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libc6-dev:i386 : Depends: linux-libc-dev:i386 but it is not going to be installed
Recommends: gcc:i386 but it is not going to be installed or
c-compiler:i386
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
root@mao-virtual-machine:~# apt-get install linux-libc-dev:i386
root@mao-virtual-machine:~# apt-get install libc6-dev:i386
root@mao-virtual-machine:~# sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32
openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
2、错误:/usr/bin/ld: cannot find -lz
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/http://www.cnblogs.com/../libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/http://www.cnblogs.com/../libz.a when searching for -lz
/usr/bin/ld: skipping incompatible //usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible //usr/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
缺少lib32z1-dev,安装即可:apt-get install lib32z1-dev
3、编译选项[-fpermissive]
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1
修改mk文件:
$ gedit frameworks/base/libs/utils/Android.mk
将:LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
改为:LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive
需要注意的是:–fpermissive 前边的-是带输入法的,改为不带输入法的 短线就可以了
4、GCC版本过高
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
原因:
此处编译错误是由于ubuntu 12.04采用了GCC4.6.3导致的。
a. 先查看系统中的gcc版本
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
可以看出gcc版本偏高!
b. 解决方法,安装低版本的gcc和g++
使用gcc4.4 版本进行编译.首先安装低版本的gcc和g++
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
c. 装完后进入到/usr/bin目录下,更改gcc,g++链接
$ cd /usr/bin
$ ls -l gcc*
lrwxrwxrwx 1 root root 7 Jan 10 18:19 gcc -> gcc-4.6
-rwxr-xr-x 1 root root 259232 Apr 16 2012 gcc-4.4
-rwxr-xr-x 1 root root 353216 Apr 16 2012 gcc-4.6
发现gcc 链接到gcc-4.6, 需要将它改为链接到gcc-4.4 :
$ sudo mv gcc gcc.bak ----先备份gcc-4.6
$ sudo ln -s gcc-4.4 gcc
同理,仍然在/usr/bin目录下
$ ls -l g++*
lrwxrwxrwx 1 root root 7 Mar 14 2012 g++ -> g++-4.6
-rwxr-xr-x 1 root root 263328 Apr 16 2012 g++-4.4
-rwxr-xr-x 1 root root 357312 Apr 16 2012 g++-4.6
需要将g++链接改为g++-4.4:
$ sudo mv g++ g++.bak ----先备份g++-4.6
$ sudo ln -s g++-4.4 g++
再查看gcc和g++版本号:
$ gcc -v
$ g++ -v
均显示gcc version 4.4,说明gcc 4.4安装成功。
5、gcc降到4.4后错误
a. 提示bits/predefs.h:没有那个文件或目录错误的
$ sudo apt-get install gcc-multilib 即可
b. g++: selected multilib '32' not installed错误
No private recovery resources for TARGET_DEVICE crespo
host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
g++: selected multilib '32' not installed
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1
make: *** Waiting for unfinished jobs....
host SharedLib: libESR_Shared (out/host/linux-x86/obj/lib/libESR_Shared.so)
g++: selected multilib '32' not installed
make: *** [out/host/linux-x86/obj/lib/libESR_Shared.so] Error 1
g++: selected multilib '32' not installed
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
解决:
$ sudo apt-get install g++-4.4-multilib
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
配置vim
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#sudo apt-get install vim
vim默认的配置使用起来还不能让人满意,还需要自己配置
默认配置文件是:/etc/vim/vimrc
我们可以在家目录下建立自己的配置文件
切换到家目录 #cd ~
touch一个名为.vimrc的文件(以.开头的为隐藏文件)
#vi .vimrc
输入以下配置:
set nocompatible 不使用vi默认键盘布局
set number 显示行号
set autoindent 自动对齐
set smartindent 智能对齐
set showmatch 括号匹配模式
set ruler 显示状态行
set incsearch 查询时非常方便,如要查找book单词,当输入到/b时,会自动找到 第一个b开头的单词,当输入到/bo时,会自动找到第一个bo开头的单词,依次类推,进行查找时,使用此设置会快速找到答案,当你找要匹配的单词时,别忘记回车.
set tabstop=4 tab键为4个空格
set shiftwidth=4 换行时行间交错使用4个空格
set softtabstop=4 设置(软)制表符宽度为4
set cindent C语言格式对齐
set nobackup 不要备份文件
set clipboard+=unnamed 与windows共享剪贴板
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
固定IP配置
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo nameserver 210.21.196.6 >> /etc/resolv.conf
route add default gw 10.1.42.254
route -n
如果设置不成功,可以先ifconfig eth0 down
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
安装tftp服务器
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1. $ apt-get install tftpd tftp openbsd-inetd
2. vim /etc/inetd.conf
找到如下配置:
#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp (/srv/tftp 为默认tftp目录)
配置自己的tftp目录:
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /home/zxf/tftpboot
3.创建目录:mkdir /home/zxf/tftpboot ;
4.$/etc/init.d/openbsd-inetd restart
5.查看69端口是否有打开 :netstat -an | more | grep udp
udp 0 0 0.0.0.0:69 0.0.0.0:*
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
配置网络文件系统nfs服务
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Ubuntu12.04 nfs的安装
apt-get install nfs-kernel-server
在终端下输入vim /etc/exports
配置完之后 在终端输入
/etc/init.d/nfs-kernel-server restart
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
不能正常关机
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sudo vim /etc/default/grub
修改GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
为GRUB_CMDLINE_LINUX_DEFAULT="acpi=off apm power_off=1 quiet splash"
保存后,执行sudo update-grub
关机的时候用sudo shutdown -h now
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
关闭独立显卡的方法
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
在终端中执行以下命令:
sudo su
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
第一句是切换到集成显卡;
第二句是关闭没有连接的显卡。
如果这时你的独显指示灯熄灭,那么恭喜!你已经成功了一大半了。
然后把这两句加到/etc/rc.local里的exit 0之前保存;以便开机时禁用独立显卡。
最后验证一下:
代码:cat /sys/kernel/debug/vgaswitcheroo/switch
我的显示:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :Off:0000:01:00.0
其中的Off即表示关闭的独显。
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
安装telnet服务
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1.、安装telnet
$sudo apt-get install xinetd telnetd
2、查看服务是否启动
$ps -e | grepxinetd
963 ? 00:00:00 xinetd
3、启动服务
$sudo /etc/init.d/xinetdstart
Rather than invoking initscripts through /etc/init.d, use the service(8)
utility, e.g. service xinetdstart
Since the script you areattempting to invoke has been converted to an
Upstart job, you may also usethe start(8) utility, e.g. start xinetd
xinetd start/running, process4051
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ssh服务安装
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1、ssh安装
$sudo apt-get installopenssh-server
2、查看服务是否启动
ps -e | grep ssh
3、启动服务
$sudo/etc/init.d/ssh resart
Rather than invoking initscripts through /etc/init.d, use the service(8)
utility, e.g. service sshresart
The script you are attemptingto invoke has been converted to an Upstart
job, but resart is notsupported for Upstart jobs.
访问其他samba服务器
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
首先需要安装samba
# apt-get install samba
1. 一种直接使用smbclient命令
# smbclient //服务器地址/目录 -U 用户名%密码
如
# smbclient //192.168.0.133/liyong -U liyong%liyong
2. 使用mount
#apt-get install smbfs
#smbmount //192.168.0.133liyong /mnt/133 -o user=liyong,pass=liyong,iocharset=utf8
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
安装飞信
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sudo apt-get install openfetion
sudo apt-get install pidgin-openfetion
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
android编译环境搭建
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
l 依赖环境:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
安装过程中,我出现了错误1。解决后:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
l 编译
进入源码目录后,执行如下命令:
$ source build/envsetup.sh
$ lunch full-eng
$ make
编译过程中出现了错误2、3、4、5.
l 运行
$ emulator
错误:
1、安装全部库时libc6-dev:i386
错误:
Errors were encountered while processing:
libc6-dev:i386
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@mao-virtual-machine:~# apt-get install libc6-dev:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dev:i386 is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libc6-dev:i386 : Depends: linux-libc-dev:i386 but it is not going to be installed
Recommends: gcc:i386 but it is not going to be installed or
c-compiler:i386
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
root@mao-virtual-machine:~# apt-get install linux-libc-dev:i386
root@mao-virtual-machine:~# apt-get install libc6-dev:i386
root@mao-virtual-machine:~# sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32
openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
2、错误:/usr/bin/ld: cannot find -lz
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/http://www.cnblogs.com/../libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/http://www.cnblogs.com/../libz.a when searching for -lz
/usr/bin/ld: skipping incompatible //usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible //usr/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
缺少lib32z1-dev,安装即可:apt-get install lib32z1-dev
3、编译选项[-fpermissive]
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1
修改mk文件:
$ gedit frameworks/base/libs/utils/Android.mk
将:LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
改为:LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive
需要注意的是:–fpermissive 前边的-是带输入法的,改为不带输入法的 短线就可以了
4、GCC版本过高
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
原因:
此处编译错误是由于ubuntu 12.04采用了GCC4.6.3导致的。
a. 先查看系统中的gcc版本
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
可以看出gcc版本偏高!
b. 解决方法,安装低版本的gcc和g++
使用gcc4.4 版本进行编译.首先安装低版本的gcc和g++
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
c. 装完后进入到/usr/bin目录下,更改gcc,g++链接
$ cd /usr/bin
$ ls -l gcc*
lrwxrwxrwx 1 root root 7 Jan 10 18:19 gcc -> gcc-4.6
-rwxr-xr-x 1 root root 259232 Apr 16 2012 gcc-4.4
-rwxr-xr-x 1 root root 353216 Apr 16 2012 gcc-4.6
发现gcc 链接到gcc-4.6, 需要将它改为链接到gcc-4.4 :
$ sudo mv gcc gcc.bak ----先备份gcc-4.6
$ sudo ln -s gcc-4.4 gcc
同理,仍然在/usr/bin目录下
$ ls -l g++*
lrwxrwxrwx 1 root root 7 Mar 14 2012 g++ -> g++-4.6
-rwxr-xr-x 1 root root 263328 Apr 16 2012 g++-4.4
-rwxr-xr-x 1 root root 357312 Apr 16 2012 g++-4.6
需要将g++链接改为g++-4.4:
$ sudo mv g++ g++.bak ----先备份g++-4.6
$ sudo ln -s g++-4.4 g++
再查看gcc和g++版本号:
$ gcc -v
$ g++ -v
均显示gcc version 4.4,说明gcc 4.4安装成功。
5、gcc降到4.4后错误
a. 提示bits/predefs.h:没有那个文件或目录错误的
$ sudo apt-get install gcc-multilib 即可
b. g++: selected multilib '32' not installed错误
No private recovery resources for TARGET_DEVICE crespo
host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
g++: selected multilib '32' not installed
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1
make: *** Waiting for unfinished jobs....
host SharedLib: libESR_Shared (out/host/linux-x86/obj/lib/libESR_Shared.so)
g++: selected multilib '32' not installed
make: *** [out/host/linux-x86/obj/lib/libESR_Shared.so] Error 1
g++: selected multilib '32' not installed
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
解决:
$ sudo apt-get install g++-4.4-multilib
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
配置vim
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#sudo apt-get install vim
vim默认的配置使用起来还不能让人满意,还需要自己配置
默认配置文件是:/etc/vim/vimrc
我们可以在家目录下建立自己的配置文件
切换到家目录 #cd ~
touch一个名为.vimrc的文件(以.开头的为隐藏文件)
#vi .vimrc
输入以下配置:
set nocompatible 不使用vi默认键盘布局
set number 显示行号
set autoindent 自动对齐
set smartindent 智能对齐
set showmatch 括号匹配模式
set ruler 显示状态行
set incsearch 查询时非常方便,如要查找book单词,当输入到/b时,会自动找到 第一个b开头的单词,当输入到/bo时,会自动找到第一个bo开头的单词,依次类推,进行查找时,使用此设置会快速找到答案,当你找要匹配的单词时,别忘记回车.
set tabstop=4 tab键为4个空格
set shiftwidth=4 换行时行间交错使用4个空格
set softtabstop=4 设置(软)制表符宽度为4
set cindent C语言格式对齐
set nobackup 不要备份文件
set clipboard+=unnamed 与windows共享剪贴板
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
固定IP配置
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo nameserver 210.21.196.6 >> /etc/resolv.conf
route add default gw 10.1.42.254
route -n
如果设置不成功,可以先ifconfig eth0 down
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
安装tftp服务器
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1. $ apt-get install tftpd tftp openbsd-inetd
2. vim /etc/inetd.conf
找到如下配置:
#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp (/srv/tftp 为默认tftp目录)
配置自己的tftp目录:
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /home/zxf/tftpboot
3.创建目录:mkdir /home/zxf/tftpboot ;
4.$/etc/init.d/openbsd-inetd restart
5.查看69端口是否有打开 :netstat -an | more | grep udp
udp 0 0 0.0.0.0:69 0.0.0.0:*
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
配置网络文件系统nfs服务
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Ubuntu12.04 nfs的安装
apt-get install nfs-kernel-server
在终端下输入vim /etc/exports
配置完之后 在终端输入
/etc/init.d/nfs-kernel-server restart
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
不能正常关机
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sudo vim /etc/default/grub
修改GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
为GRUB_CMDLINE_LINUX_DEFAULT="acpi=off apm power_off=1 quiet splash"
保存后,执行sudo update-grub
关机的时候用sudo shutdown -h now
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
关闭独立显卡的方法
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
在终端中执行以下命令:
sudo su
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
第一句是切换到集成显卡;
第二句是关闭没有连接的显卡。
如果这时你的独显指示灯熄灭,那么恭喜!你已经成功了一大半了。
然后把这两句加到/etc/rc.local里的exit 0之前保存;以便开机时禁用独立显卡。
最后验证一下:
代码:cat /sys/kernel/debug/vgaswitcheroo/switch
我的显示:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :Off:0000:01:00.0
其中的Off即表示关闭的独显。
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
安装telnet服务
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1.、安装telnet
$sudo apt-get install xinetd telnetd
2、查看服务是否启动
$ps -e | grepxinetd
963 ? 00:00:00 xinetd
3、启动服务
$sudo /etc/init.d/xinetdstart
Rather than invoking initscripts through /etc/init.d, use the service(8)
utility, e.g. service xinetdstart
Since the script you areattempting to invoke has been converted to an
Upstart job, you may also usethe start(8) utility, e.g. start xinetd
xinetd start/running, process4051
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ssh服务安装
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1、ssh安装
$sudo apt-get installopenssh-server
2、查看服务是否启动
ps -e | grep ssh
3、启动服务
$sudo/etc/init.d/ssh resart
Rather than invoking initscripts through /etc/init.d, use the service(8)
utility, e.g. service sshresart
The script you are attemptingto invoke has been converted to an Upstart
job, but resart is notsupported for Upstart jobs.
相关文章推荐
- ubuntu12.04 64bit 常见问题
- ubuntu12.04 64bit 常见问题
- ubuntu12.04 64bit和win7 64bit双硬盘安装若干问题记录
- Ubuntu12.04下 tree安装的常见问题
- Ubuntu12.04-64Bit经典桌面环境右键没有反应问题解决
- ubuntu12.04 64bit 循环登录,无法进桌面的问题
- ubuntu12.04桌面版安装python模块常见问题
- ubuntu12.04 64bit 编译android源码时遇到的问题"make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates"
- Angularjs学习---ubuntu12.04中karma安装配置中常见的问题总结
- ubuntu12.04 64bit编译android ics4.0代码出现的/usr/bin/ld.bfd.real: cannot find 问题解决
- GO 在window 64bit的下的常见问题(一)
- ubuntu12.04 64bit 编译android源码时遇到的问题
- ubuntu12.04 64bit编译android ics4.0代码出现的/usr/bin/ld.bfd.real: cannot find 问题解决
- ubuntu12.04 64bit交叉编译器问题
- 技嘉主板常见问题解答
- 开发工具常见问题及解决方法
- 暂时性死区常见问题
- 在ASP.NET中使用Session常见问题集锦
- Wap中常见Asp+Wml问题
- 使用RealViewMDK时常见的问题(1)