本文以安裝postgreSQL為例說明了Gentoo Linux 安裝 軟體的一般方法,同時總結了USE flag.
運行 emerge -pv postgresql-server 看下USE
[plain] view plaincopyprint?
- # emerge -pv postgresql-server
-
- These are the packages that would be merged, in order:
-
- Calculating dependencies... done!
- [ebuild N ] dev-db/postgresql-server-9.3.3 USE="nls pam xml -doc -perl -pg_legacytimestamp -python (-selinux) -tcl -uuid" LINGUAS="-af -cs -de -en -es -fa -fr -hr -hu -it -ko -nb -pl -pt_BR -ro -ru -sk -sl -sv -tr -zh_CN -zh_TW" 3 kB
-
- Total: 1 package (1 new), Size of downloads: 3 kB
------------------------------------------------------
【附】Gentoo USE:
USE的簡單理解如下:一個軟體不只包含軟體本身,還包括其組件,如,文檔,外掛程式,GUI支援等。USE就是用來標記是否要安裝軟體的同時安裝這些組件。
臨時USE : USE="-java" emerge seamonkey
USE flag的顏色
紅色:enable
藍色:前面會帶一個”-”,表示disable。
綠色:enable但是還沒有邊進去的use flag
黃色:上一個版本沒有,這一個版本新加入的use flag
括弧():在你的平台上禁用的use flag
參考:
1.http://blog.csdn.net/aceking10/article/details/17116299
2.http://www.gentoo.org/doc/zh_cn/handbook/handbook-x86.xml?part=2&chap=2
3.http://forums.gentoo.tw/viewtopic.php?f=15&t=44462
------------------------------------------------------
設定 USE="python" LINGUAS="en zh_CN"
[plain] view plaincopyprint?
- # USE="python" LINGUAS="en zh_CN" emerge -pv postgresql-server
-
- These are the packages that would be merged, in order:
-
- Calculating dependencies... done!
- [ebuild N ] dev-db/postgresql-server-9.3.3 USE="nls pam python xml -doc -perl -pg_legacytimestamp (-selinux) -tcl -uuid" LINGUAS="en zh_CN -af -cs -de -es -fa -fr -hr -hu -it -ko -nb -pl -pt_BR -ro -ru -sk -sl -sv -tr -zh_TW" 3 kB
-
- Total: 1 package (1 new), Size of downloads: 3 kB
運行: USE="python" LINGUAS="en zh_CN" emerge postgresql-server 安裝postgresql-server
[plain] view plaincopyprint?
- USE="python" LINGUAS="en zh_CN" emerge postgresql-server
等待安裝(我安的時候比較費時。。)
完成時有如下提示:
[plain] view plaincopyprint?
- * If you have users and/or services that you would like to utilize the
- * socket, you must add them to the 'postgres' system group:
- * usermod -a -G postgres <user>
- *
- * Before initializing the database, you may want to edit PG_INITDB_OPTS
- * so that it contains your preferred locale in:
- * /etc/conf.d/postgresql-9.3
- *
- * Then, execute the following command to setup the initial database
- * environment:
- * emerge --config =dev-db/postgresql-server-9.3.3
- gt;>> Auto-cleaning packages...
按照提示編輯 /etc/conf.d/postgresql-9.3 (可以直接使用預設,不做任何更改,遇到問題了再改)
[plain] view plaincopyprint?
- # 設定檔位置
- PGDATA="/etc/postgresql-9.3/"
-
- # 資料存放目錄/to be created
- DATA_DIR="/var/lib/postgresql/9.3/data"
-
- # 可選 選項
- PG_INITDB_OPTS="--locale=en_US.UTF-8"
按照提示,運行:emerge --config =dev-db/postgresql-server-9.3.3
[plain] view plaincopyprint?
- # emerge --config =dev-db/postgresql-server-9.3.3
- ........
-
-
- * The autovacuum function, which was in contrib, has been moved to the main
- * PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled
- * by default. You can disable it in the cluster's:
- * /etc/postgresql-9.3/postgresql.conf
- *
- * The PostgreSQL server, by default, will log events to:
- * /var/lib/postgresql/9.3/data/postmaster.log
- *
- * You should use the '/etc/init.d/postgresql-9.3' script to run PostgreSQL
- * instead of 'pg_ctl'.
然後,繼續安裝上條命令完成時的提示(You should use the '/etc/init.d/postgresql-9.3' script to run PostgreSQL):
啟動postgreSQL服務:/etc/init.d/postgresql-9.3 start
[plain] view plaincopyprint?
- # /etc/init.d/postgresql-9.3 start
- * Caching service dependencies ... [ ok ]
- * /var/run/postgresql: creating directory
- * /var/run/postgresql: correcting owner
- * Starting PostgreSQL ... [ ok ]
測試 postgresql
[plain] view plaincopyprint?
- # psql -U postgres
- psql (9.3.3)
- Type "help" for help.
-
- postgres=# \l
- List of databases
- Name | Owner | Encoding | Collate | Ctype | Access privileges
- -----------+----------+----------+-------------+-------------+-----------------------
- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
- template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
- | | | | | postgres=CTc/postgres
- template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
- | | | | | postgres=CTc/postgres
- (3 rows)
-
- postgres=#
參考:http://blog.csdn.net/cenziboy/article/details/7357066