顯示具有 Ubuntu 標籤的文章。 顯示所有文章
顯示具有 Ubuntu 標籤的文章。 顯示所有文章

2017年1月20日 星期五

常用的APT命令參數:


apt-cache search package 搜尋套件
apt-cache show package 獲取套件的相關信息,如說明、大小、版本等


apt-cache depends package 相依性:可以用這個指令來看到某個rpm的所有相依性檔案

apt-cache rdepends package 是查看該套件被哪些套件依賴


sudo apt-get install package 安裝套件

sudo apt-get install package -- reinstall 重新安裝套件

sudo apt-get -f install 修復安裝"-f = --fix-missing"

sudo apt-get remove package 刪除套件,如有相依性套件時會一併移除 

sudo apt-get remove package -- purge 刪除套件,套件括刪除配置文件等


sudo apt-get update 取得在/etc/apt/sources.list 內的遠端伺服器的套件檔案清單

sudo apt-get upgrade 更新已安裝的套件,
--fix-missing(如果有些套件無法取得)
sudo apt-get dist-upgrade 升級系統


sudo apt-get build-dep package 安裝相關的編譯環境


apt-get source package 下載該套件的源代碼


sudo apt-get clean 當使用 apt-get install 指令安裝套件,下載下來的rpm會放置於 

                   /var/cache/apt/archives,使用本指令可以將之清除

sudo apt-get check 檢查套件


 

2016年9月14日 星期三

[轉] Ubuntu Linux 環境變量PATH設置


Ubuntu Linux系統環境變量配置文件: /etc/profile : 在登錄時,操作系統定制用戶環境時使用的第一個文件 ,此文件为系統的每個用戶設置環境信息,當用戶第一次登錄時,該文件被執行

Ubuntu Linux系統環境變量配置文件: 
/etc/profile : 在登錄時,操作系統定制用戶環境時使用的第一個文件 ,此文件为系統的每個用戶設置環境信息,當用戶第一次登錄時,該文件被執行。 

/etc /environment : 在登錄時操作系統使用的第二個文件, 系統在讀取你自己的profile前,設置環境文件的環境變量。 

~/.profile :  在登錄時用到的第三個文件 是.profile文件,每個用戶都可使用該文件輸入專用於自己使用的shell信息,當用戶登錄時,該文件僅僅執行一次!默認情況下,他設置一些環境變量,執行用戶的.bashrc文件。 

/etc/bashrc : 为每一個運行bash shell的用戶執行此文件.當bash shell被打開時,該文件被讀取. 

~/.bashrc : 該文件包含專用於你的bash shell的bash信息,當登錄時以及每次打開新的shell時,該該文件被讀取。 



PASH環境變量的設置方法: 

方法一:用戶主目錄下的.profile或.bashrc文件(推薦) 

登錄到你的用戶(非root),在終端輸入: 
$ sudo gedit ~/.profile(or .bashrc) 
可以在此文件末尾加入PATH的設置如下: 
export PATH=”$PATH:your path1:your path2 ...” 
保存文件,注銷再登錄,變量生效。 
該方式添加的變量只對當前用戶有效。 

方法二:系統目錄下的profile文件(謹慎) 

在系統的etc目錄下,有一個profile文件,編輯該文件: 
$ sudo gedit /etc/profile 
在最後加入PATH的設置如下: 
export PATH=”$PATH:your path1:your path2 ...” 
該文件編輯保存後,重启系統,變量生效。 
該方式添加的變量對所有的用戶都有效。 

方法三:系統目錄下的 environment 文件(謹慎) 

在系統的etc目錄下,有一個environment文件,編輯該文件: 
$ sudo gedit /etc/environment 
找到以下的 PATH 變量: 
PATH="<......>" 
修改該 PATH 變量,在其中加入自己的path即可,例如: 
PATH="<......>:your path1:your path2 …" 
各個path之間用冒號分割。該文件也是重启生效,影響所有用戶。 
注意這裏不是添加export PATH=… 。 

方法四:直接在終端下輸入 

$ sudo export PATH="$PATH:your path1:your path2 …" 
這種方式變量立即生效,但用戶注銷或系統重启後設置變成無效,适合臨時變量的設置。 


注 意:方法二和三的修改需要謹慎,尤其是通過root用戶修改,如果修改錯誤,將可能導致一些嚴重的系統錯誤。因此筆者推薦使用第一種方法。另外嵌入式 Linux的開發最好不要在root下進行(除非你對Linux已經非常熟悉了!!),以免因为操作不當導致系統嚴重錯誤。 

下面是一個對environment文件錯誤修改導致的問題以及解决方法示例: 

問題:因为不小心在 etc/environment裏設在環境變量導致無法登錄 
提示:不要在 etc/environment裏設置 export PATH這样會導致重启後登錄不了系統 
解决方法: 
在登錄界面 alt +ctrl+f1進入命令模式,如果不是root用戶需要鍵入(root用戶就不許這麼罗嗦,gedit編輯會不可顯示) 
/usr/bin/sudo /usr/bin/vi /etc/environment 
光標移到export PATH** 行,連續按 d兩次刪除該行; 
輸入:wq保存退出; 
然後鍵入/sbin/reboot重启系統(可能會提示need to boot,此時直接power off) 

Ubuntu 14.04設定網路連線

http://blog.xuite.net/yh96301/blog/242434403-Ubuntu+14.04%E8%A8%AD%E5%AE%9A%E7%B6%B2%E8%B7%AF%E9%80%A3%E7%B7%9A%E7%82%BA%E5%9B%BA%E5%AE%9AIP

2013年10月5日 星期六

Ubuntu 11.10 手動安裝 Sun Java 6 JDK


手動安裝JDK


sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk

==================================================
手動安裝JRE


sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

2013年8月30日 星期五

[轉] 更改Ubuntu的source list

在Ubuntu上下載套件常常會遇上下載過慢的情形
常常跑完都一天過去了,或者是看著他一動也不動得卡在那裡
後來經學長丟了個網址 

[Ubuntu] 更改 Ubuntu 10.04 的 sources.list

下載速度過慢的問題終於解決了
我就來講講我的作法吧,雖然跟生蛋大ㄧ模一樣
一樣先進到終端機畫面,先登入root管理者模式
sudo su


輸入所設定的密碼即可
sourceslist1.JPG
接著複製sources.list的內容,以防萬一
cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
刪除目前的sources.list
rm -rf /etc/apt/sources.list
接著編輯sources.list,由於我的Ubuntu沒有vim的功能
目前也迷樣的裝不起來,之後再研究
所以我選擇用gedit來編輯我的sources.list
gedit /etc/apt/sources.list
打開空白sources.list,將生蛋大給的code全貼上去
#deb cdrom:[Ubuntu 10.04 LTS _Lucid Lynx_ - Release i386 (20100429)]/ lucid main restricted
# See http://help.ubuntu.com/community/UpgradeNotesfor how to upgrade to
# newer versions of the distribution.
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid main restricted
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid-updates main restricted
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid universe
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid universe
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid-updates universe
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid multiverse
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid multiverse
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid-updates multiverse
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid-updates multiverse
## Uncomment the following two lines to add software from the ‘backports’
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://tw.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
# deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical’s
## ‘partner’ repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu lucid partner
# deb-src http://archive.canonical.com/ubuntu lucid partner
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid-security main restricted
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid-security main restricted
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid-security universe
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid-security universe
deb http://ubuntu.stu.edu.tw/ubuntu/ lucid-security multiverse
deb-src http://ubuntu.stu.edu.tw/ubuntu/ lucid-security multiverse

大概像這樣子
sourceslist3.JPG
儲存後關閉
這麼一來下載的速度就會很快了。