Initializing a Build Environment
This section describes how to set up your local work environment to build the Android source files. You will need to use Linux or Mac OS. Building under Windows is not currently supported.
android官方链接
Installing Java6 JDK on Ubuntu 12.04
-
android官方提供的方法(有时可以,有时不可以)
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" $ sudo apt-get update $ sudo apt-get install sun-java6-jdk
-
如果android官方方法行不通,可以参考这个方法
它在github上的页面mkdir ~/src cd ~/src git clone https://github.com/flexiondotorg/oab-java6.git cd ~/src/oab-java6 sudo ./oab-java.sh sudo apt-get install sun-java6-plugin sun-java6-jre sun-java6-bin sun-java6-jdk 这种方法有时成功,有时失败,[ERROR! Packages failed to build.](https://github.com/flexiondotorg/oab-java6/issues/91),没有解决。
编译错误
-
fatal error: bfd.h: No such file or directory
sudo apt-get install binutils-dev
参考链接make: *** [out/host/linux-x86/obj/EXECUTABLES/opannotate_intermediates/opannotate.o] Error 1 make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/diff_container.o] Error 1 In file included from external/oprofile/libpp/format_output.h:22:0, from external/oprofile/libpp/arrange_profiles.cpp:24: external/oprofile/libpp/symbol.h:21:17: fatal error: bfd.h: No such file or directory compilation terminated.
用户管理
新建用户并添加到管理组
作者:Ubuntu中文社区
原文网址:http://wiki.ubuntu.org.cn/新建用户并添加到管理组
以root权限进行如下操作:
- 输入用户管理的命令,新建用户(以TEST为例),并设置用户密码:
useradd TEST
passwd TEST- 将新用户添加到管理组(可以执行sudo):
sudo usermod -a -G sudo TEST- 创建TEST用户目录:
cd /home
mkdir TEST
chown TEST /home/TEST- 重启机器:
reboot
然后用 TEST 登录,在 菜单“系统-系统管理-用户和组”,进去选中你的用户,点右边的“属性”按钮,到用户权限里打勾需要的;
在图形界面下新建用户,
在terminal新建的用户没有欢迎界面,
初始用户和新建用户的 .bashrc 有区别。
普通用户与root用户之间的切换:su, sudo
作者:鸟哥的Linux私房菜
原文网址:http://linux.vbird.org/linux_basic/0410accountmanager/0410accountmanager-fc4.php
$ su - Password: <==這裡輸入 root 的密碼喔! # exit <==這樣可以離開 su 的環境!
命令 | $PWD | $HOME | 密码 |
---|---|---|---|
sudo su |
当前路径 | /root | 用户登录密码 |
sudo -s |
当前路径 | /home/user | 用户登录密码 |
sudo -i |
/root | /root | 用户登录密码 |
su |
当前路径 | /root | root密码 |
sudo su will give you a root shell as root.
sudo -s will give you a root shell as /you/. Try both and do an echo $HOME to see the difference.
sudo su is the equivalent to sudo -i.
how to copy files into usr local permission denied?
is not in the sudoers file. This incident will be reported.
作者:鸟哥的Linux私房菜
原文网址:http://linux.vbird.org/linux_basic/0410accountmanager/0410accountmanager-fc4.php
新用户在执行sudo命令时如果碰到如下错误提示,通过添加新用户到配置文件/etc/sudoers中解决:
is not in the sudoers file. This incident will be reported.
因為 /etc/sudoers 需要一些比較特別的語法,因此,如果你直接以 vi 去編輯他時, 如果輸入的字句錯誤,可能會造成無法啟用 sudo 的困擾,因此,建議您一定要使用 visudo 去編輯 /etc/sudoers 喔!(註: visudo 必須要使用 root 的身份來執行!)
[[email protected] ~]# visudo # sudoers file. # This file MUST be edited with the 'visudo' command as root. # See the sudoers man page for the details on how to write a sudoers file. root ALL=(ALL) ALL dmtsai ALL=(ALL) ALL <==這裡將 dmtsai 製作成完全可用!
那一行『 dmtsai ALL=(ALL) ALL 』代表的意義是:
使用者帳號 登入的主機 = (可以變換的身份) 可以下達的指令
修改/etc/sudoers可能会产生问题” sudo: no valid sudoers sources found,quitting “
原文网址:http://libin0019.iteye.com/blog/1209272
- 错误提示: /etc/sudoers is mode 0640, should be 0440, sudo: no valid sudoers sources found,quitting
可能是因为执行chmod u+w /etc/sudoers. 解决办法:
- 重启系统,长按shift键进入(recovery mode/恢复模式)引导项;
- 在Recovery Menu页面选择root后回车;
- 设置或者撤销/etc/sudoers文件的权限,命令如下:
chmod u-w /etc/sudoers
- 错误提示:chomd :changing permissions of ‘sudoers’ :Read-only file system
解决办法:利用 mount 指令解决 Read-only file system的问题
mount -o remount rw /
修改用户的Shell
新建用户的默认shell是 /bin/sh,使用不方便,比如:
- 左右键不是移动的效果,而显示字符序列;
- 上下键不能切换历史命令,也是显示字符序列;
- tab键全是空格(不能自动补全);
- 提示符$之前没有路径;
所以,需要 修改用户的Shell:
作者:neoease
原文网址:http://www.neoease.com/change-shell-on-ubuntu/
- 如果你没有管理员权限, 那么你只能修改自己的 Shell, 输入 chsh 命令.
$ chsh -s /bin/bash- 如果具有管理员权限,可以通过修改配置文件修改.
# vi /etc/passwd
这里只需要件 /bin/sh 改成 /bin/bash 即可.- 添加用户时指定 Shell
在添加用户时可以通过以下命令指定 Shell.
# useradd -s /bin/bash {用户昵称}
修改shell后需用重启终端,通过echo $SHELL 可以查看修改结果。
用户没有home directory时,编辑配置文档会碰到如下错误提示
$ sudo gedit /etc/sudoers
PuTTY X11 proxy: wrong authorisation protocol attempted
(gedit:11427): Gtk-WARNING **: cannot open display: localhost:11.0