JAVA Runtime Environment (JRE) 是經常使用的工具,但是受限於版權的因素,Debian Linux 並沒有把 Oracle 的 Java Runtime Environment 包進來,而 JRE 又經常因為安全性的因素更新。在這種情況下,我們只能手動更新 JRE,否則將會有漏洞而導致系統安全發生。底下將介紹如何安裝 JRE。
1. 下載
請至 Oracle 官方網站下載 JRE,其網址如下:
http://java.com/zh_TW/download/
依本文章為例,我們所下載的 JRE 是 jre-7u60-linux-x64.tar.gz。
2. 解壓縮
我們將 JRE 解壓縮至 /usr/local/java 目錄下,請以 root 權限先建立 /usr/local/java 目錄,指令如下:
#mkdir -p /usr/local/java
接著再將 jre-7u60-linux-x64.tar.gz 解壓縮至 /usr/local/java 目錄,指令如下:
#tar xfva jre-7u60-linux-x64.tar.gz -C /usr/local/java
此時會出現一個目錄,其完整路徑為 /usr/local/java/jre1.7.0_60。
接著請建立一個 /usr/local/java/cur 連結至 /usr/local/java/jre1.7.0_60 目錄:
ln -s /usr/local/java/jre1.7.0_60 /usr/local/java/cur
3. 安裝
請以 root 權限執行底下指令:
#update-alternatives --install /usr/bin/java java /usr/local/java/cur/bin/java 1
#update-alternatives --set java /usr/local/java/cur/bin/java
4. 設定環境
請在 ~/.bashrc 目錄下加入底下幾行:
JAVA="/usr/local/java"
JAVAbin="/usr/local/java/cur/bin"
CLASSPATH="/usr/share/java"
export JAVA_HOME="/usr/local/java/cur"
export PATH=$PATH:$JAVAbin
5. 安裝 firefox plugin
在安裝 firefox plugin 前,必須先關閉 firefox,接著以一般使用者權限至 ~/.mozilla/plugins 目錄下執行底下指令:
~/.mozilla/plugins $ ln -sf /usr/local/java/cur/lib/amd64/libnpjp2.so .
6. 測試 JRE 是否安裝成功 ?
以 firefox 連線至官方網頁測試即可,網址在:
https://www.java.com/en/download/installed.jsp
2014年6月24日 星期二
2014年6月19日 星期四
進階 Linux 作業系統期末上機考
1. 建立一個 deb_mirror.img,其大小為 4GB,此檔案必須可以支援中文 Debian 以及英文 Debian 之安裝。
2. 在 linux.img 中設定編譯 linaro qemu 環境,設定指令如下:
./configure --enable-tcg-interpreter --enable-gcov --enable-tpm
要設定到如底下所示
pixman system
SDL support yes
GTK support yes
curses support yes
curl support yes
mingw32 support no
Audio drivers oss
Block whitelist (rw)
Block whitelist (ro)
VirtFS support yes
VNC support yes
VNC TLS support yes
VNC SASL support yes
VNC JPEG support yes
VNC PNG support yes
VNC WS support yes
xen support no
brlapi support no
bluez support yes
Documentation yes
GUEST_BASE yes
PIE yes
vde support yes
Linux AIO support yes
ATTR/XATTR support yes
Install blobs yes
KVM support yes
RDMA support yes
TCG interpreter yes
fdt support yes
preadv support yes
fdatasync yes
madvise yes
posix_madvise yes
sigev_thread_id yes
uuid support yes
libcap-ng support yes
vhost-net support yes
vhost-scsi support yes
Trace backend nop
Trace output file trace-<pid>
spice support yes (0.12.6/0.12.4)
rbd support yes
xfsctl support yes
nss used yes
libusb yes
usb net redir yes
GLX support yes
libiscsi support yes
build guest agent yes
QGA VSS support no
seccomp support yes
coroutine backend ucontext
coroutine pool yes
GlusterFS support no
virtio-blk-data-plane yes
gcov gcov
gcov enabled yes
TPM support yes
libssh2 support yes
TPM passthrough yes
QOM debugging yes
vhdx yes
2. 在 linux.img 中設定編譯 linaro qemu 環境,設定指令如下:
./configure --enable-tcg-interpreter --enable-gcov --enable-tpm
要設定到如底下所示
pixman system
SDL support yes
GTK support yes
curses support yes
curl support yes
mingw32 support no
Audio drivers oss
Block whitelist (rw)
Block whitelist (ro)
VirtFS support yes
VNC support yes
VNC TLS support yes
VNC SASL support yes
VNC JPEG support yes
VNC PNG support yes
VNC WS support yes
xen support no
brlapi support no
bluez support yes
Documentation yes
GUEST_BASE yes
PIE yes
vde support yes
Linux AIO support yes
ATTR/XATTR support yes
Install blobs yes
KVM support yes
RDMA support yes
TCG interpreter yes
fdt support yes
preadv support yes
fdatasync yes
madvise yes
posix_madvise yes
sigev_thread_id yes
uuid support yes
libcap-ng support yes
vhost-net support yes
vhost-scsi support yes
Trace backend nop
Trace output file trace-<pid>
spice support yes (0.12.6/0.12.4)
rbd support yes
xfsctl support yes
nss used yes
libusb yes
usb net redir yes
GLX support yes
libiscsi support yes
build guest agent yes
QGA VSS support no
seccomp support yes
coroutine backend ucontext
coroutine pool yes
GlusterFS support no
virtio-blk-data-plane yes
gcov gcov
gcov enabled yes
TPM support yes
libssh2 support yes
TPM passthrough yes
QOM debugging yes
vhdx yes
2014年6月18日 星期三
自行編譯「完整版 Linaro Qemu」
Linaro Qemu 是 Linaro 基金會所支援的 Qemu,它較官方的 Qemu 支援更多 ARM 硬體,因此十分適合用在嵌入式系統開發上面。qemu linaro 有一項特異功能是使用 usb redir net 以使用網路傳遞 usb 通訊協定, 但是 debian wheezy 的函式庫過於老舊以致於無法將 qemu linaro 的這項功能啟動,在此介紹如何自行外加新版的函式庫以啟動此功能。
假設在 qemu linaro 目錄下執行 ./configure 出現:
ERROR: pixman not present. Your options:
(1) Preferred: Install the pixman devel package (any recent
distro should have packages as Xorg needs pixman too).
(2) Fetch the pixman submodule, using:
git submodule update --init pixman
其解決方式如下:
apt-get install libpixman-1-dev
若是 ./configure 出現問題:
ERROR: DTC not present. Your options:
(1) Preferred: Install the DTC devel package
(2) Fetch the DTC submodule, using:
git submodule update --init dtc
其解決方式為:
apt-get install libfdt-dev
之後有可能出現的錯誤訊息是:
GTK support no
的訊息,我們可以檢視 configure 檔案,裡面有底下段落:
##########################################
# GTK probe
if test "$gtk" != "no"; then
gtkpackage="gtk+-$gtkabi"
if test "$gtkabi" = "3.0" ; then
gtkversion="3.0.0"
vtepackage="vte-2.90"
vteversion="0.32.0"
else
gtkversion="2.18.0"
vtepackage="vte"
vteversion="0.24.0"
.. (中略)
elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
if test "$gtk" = "yes" ; then
error_exit "libvte not found (required for gtk support)"
.. (下略)
我們可以看到上面有一行:
error_exit "libvte not found (required for gtk support)"
此訊息表示 libvte-dev 之類名稱的套件沒有安裝,我們可以利用 aptitude 安裝 libvte-dev 套件,再執行 ./configure 看看。
seccomp support no
這表示我們沒有安裝 libseccomp-dev 套件,但是此套件目前在 Wheezy 底下並沒有出現,必須設定 Debian backports 才可以安裝,設定方式請在 /etc/apt/sources.list 中加入底下內容:
#Wheezy Backports
deb http://ftp.tw.debian.org/debian wheezy-backports main
接著執行 apt-get update; apt-get install libseccomp-dev 即可安裝。安裝完畢後我們再執行
./configure
其狀態如下:
seccomp support yes
1. 下載必要函式庫
apt-get install
libnss3-dev
libudev-dev
libpng12-dev
libghc6-zlib-dev
libogg-dev
libglobus-openssl-dev
libxrandr-dev
libxfixes-dev
libjpeg8-dev
libsasl2-dev
libiscsi-dev
librbd-dev
xfslibs-dev
libbrlapi-dev
libbluetooth-dev
libxen-dev
spice - http://spice-space.org/download.html
http://www.spice-space.org/download/releases/spice-0.12.5.tar.bz2
http://www.spice-space.org/download/releases/spice-protocol-0.12.7.tar.bz2
http://www.spice-space.org/download/usbredir/usbredir-0.7.tar.bz2
https://alioth.debian.org/frs/download.php/3842/pcsc-lite-1.8.7.tar.bz2
#https://alioth.debian.org/frs/download.php/3757/pcsc-lite-1.8.6.tar.bz2
http://jaist.dl.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.19/libusb-1.0.19.tar.bz2
但是在編 spice 時會說 pixman 版本太舊,因此我們還要自行安裝新版 pixman。
pixman - http://cgit.freedesktop.org/pixman/
http://cgit.freedesktop.org/pixman/snapshot/pixman-0.28.2.tar.gz
libcacard - http://spice-space.org/download/libcacard/
http://spice-space.org/download/libcacard/libcacard-0.1.2.tar.bz2
2. 安裝
pcsc-lite-1.8.7 安裝步驟:
tar xfva pcsc-lite-1.8.7.tar.bz2
cd pcsc-lite-1.8.7
./configure
make
# make install
libcacard 安裝步驟:
tar xfva libcacard-0.1.2.tar.bz2
./configure
錯誤訊息:
checking for NSS... no
configure: error: Package requirements (nss) were not met:
No package 'nss' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables NSS_CFLAGS
and NSS_LIBS to avoid the need to call pkg-config.
請安裝
libnss3-dev
即可。
make -j N
make install
libusb-1.0.18 安裝步驟:
tar xfva libusb-1.0.18.tar.bz2
cd libusb-1.0.18
./configure
make -j N
#make install
usbredir-0.7 安裝步驟:
tar xfva usbredir-0.7.tar.bz2
cd usbredir-0.7
./configure
make -j N
#make install
spice-protocol-0.12.7 安裝
tar xfva spice-protocol-0.12.7.tar.bz2
cd spice-protocol-0.12.7
./configure
make -j N
#make install
#cp /usr/local/share/pkgconfig/spice-protocol.pc /usr/lib/pkgconfig/
pixman 安裝步驟:
tar xfva pixman-0.28.2.tar.gz
cd pixman-0.28.2
./autogen
./configure
make -j N
# make install
celt 安裝步驟:
請注意 SPICE 只接受 CELT 0.51 版,因此不要安裝比此新的版本:
wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz
tar xfv celt-0.5.1.3.tar.gz
cd celt-0.5.1.3
./configure
make -j N
#make install
cd /usr/local/lib/pkgconfig
/usr/local/lib/pkgconfig# ln -s celt.pc celt051.pc
spice
spice 安裝步驟:
tar xfva spice-0.12.5.tar.bz2
cd spice-0.12.5
./configure --enable-smartcard
但是執行此指令不一定能順利執行,大多數的情況下會有錯誤,我們要一一處理,例如:
錯誤訊息:
checking for CELT051... no
configure: error: Package requirements (celt051 >= 0.5.1.1) were not met:
No package 'celt051' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables CELT051_CFLAGS
and CELT051_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
如果遇上以上錯誤訊息的話請先安裝先前所提到的 celt 0.51 套件:
錯誤訊息:
checking for pyparsing python module... not found
configure: error: pyparsing python module is required to compile this package
請安裝底下套件:
python-pyparsing
即可。
錯誤訊息:
checking sasl/sasl.h usability... no
checking sasl/sasl.h presence... no
checking for sasl/sasl.h... no
checking for sasl_client_init in -lsasl2... no
checking for sasl_client_init in -lsasl... no
configure: error: Missing required Cyrus SASL development package
請安裝底下套件:
libsasl2-dev
即可
錯誤訊息:
checking for SMARTCARD... no
configure: error: Package requirements (libcacard >= 0.1.2) were not met:
No package 'libcacard' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables SMARTCARD_CFLAGS
and SMARTCARD_LIBS to avoid the need to call pkg-config.
請依先前步驟安裝 libcacard 0.1.2 即可。
qemu
tar xfva qemu-linaro-1.7.0-2014.01.tar.gz
cd qemu-linaro-1.7.0-2014.01
./configure
time make -j 4
su
# make install
安裝完畢後可以執行底下指令來看看 qemu-linaro 版是否能正確執行:
qemu-system-arm -version
如果出現底下錯誤訊息的話,表示動態連結函式庫沒設定好:
qemu-system-arm: error while loading shared libraries: libspice-server.so.1: cannot open shared object file: No such file or directory
請以 root 權限執行:
# ldconfig
再回到一般使用者權限即可執行:
$ qemu-system-arm -version
QEMU emulator version 1.7.0 (qemu-linaro 2014.01), Copyright (c) 2003-2008 Fabrice Bellard
假設在 qemu linaro 目錄下執行 ./configure 出現:
ERROR: pixman not present. Your options:
(1) Preferred: Install the pixman devel package (any recent
distro should have packages as Xorg needs pixman too).
(2) Fetch the pixman submodule, using:
git submodule update --init pixman
其解決方式如下:
apt-get install libpixman-1-dev
若是 ./configure 出現問題:
ERROR: DTC not present. Your options:
(1) Preferred: Install the DTC devel package
(2) Fetch the DTC submodule, using:
git submodule update --init dtc
其解決方式為:
apt-get install libfdt-dev
之後有可能出現的錯誤訊息是:
GTK support no
的訊息,我們可以檢視 configure 檔案,裡面有底下段落:
##########################################
# GTK probe
if test "$gtk" != "no"; then
gtkpackage="gtk+-$gtkabi"
if test "$gtkabi" = "3.0" ; then
gtkversion="3.0.0"
vtepackage="vte-2.90"
vteversion="0.32.0"
else
gtkversion="2.18.0"
vtepackage="vte"
vteversion="0.24.0"
.. (中略)
elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
if test "$gtk" = "yes" ; then
error_exit "libvte not found (required for gtk support)"
.. (下略)
我們可以看到上面有一行:
error_exit "libvte not found (required for gtk support)"
此訊息表示 libvte-dev 之類名稱的套件沒有安裝,我們可以利用 aptitude 安裝 libvte-dev 套件,再執行 ./configure 看看。
seccomp support no
這表示我們沒有安裝 libseccomp-dev 套件,但是此套件目前在 Wheezy 底下並沒有出現,必須設定 Debian backports 才可以安裝,設定方式請在 /etc/apt/sources.list 中加入底下內容:
#Wheezy Backports
deb http://ftp.tw.debian.org/debian wheezy-backports main
接著執行 apt-get update; apt-get install libseccomp-dev 即可安裝。安裝完畢後我們再執行
./configure
其狀態如下:
seccomp support yes
1. 下載必要函式庫
apt-get install
libnss3-dev
libudev-dev
libpng12-dev
libghc6-zlib-dev
libogg-dev
libglobus-openssl-dev
libxrandr-dev
libxfixes-dev
libjpeg8-dev
libsasl2-dev
libiscsi-dev
librbd-dev
xfslibs-dev
libbrlapi-dev
libbluetooth-dev
libxen-dev
spice - http://spice-space.org/download.html
http://www.spice-space.org/download/releases/spice-0.12.5.tar.bz2
http://www.spice-space.org/download/releases/spice-protocol-0.12.7.tar.bz2
http://www.spice-space.org/download/usbredir/usbredir-0.7.tar.bz2
https://alioth.debian.org/frs/download.php/3842/pcsc-lite-1.8.7.tar.bz2
#https://alioth.debian.org/frs/download.php/3757/pcsc-lite-1.8.6.tar.bz2
http://jaist.dl.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.19/libusb-1.0.19.tar.bz2
但是在編 spice 時會說 pixman 版本太舊,因此我們還要自行安裝新版 pixman。
pixman - http://cgit.freedesktop.org/pixman/
http://cgit.freedesktop.org/pixman/snapshot/pixman-0.28.2.tar.gz
libcacard - http://spice-space.org/download/libcacard/
http://spice-space.org/download/libcacard/libcacard-0.1.2.tar.bz2
2. 安裝
pcsc-lite-1.8.7 安裝步驟:
tar xfva pcsc-lite-1.8.7.tar.bz2
cd pcsc-lite-1.8.7
./configure
make
# make install
libcacard 安裝步驟:
tar xfva libcacard-0.1.2.tar.bz2
./configure
錯誤訊息:
checking for NSS... no
configure: error: Package requirements (nss) were not met:
No package 'nss' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables NSS_CFLAGS
and NSS_LIBS to avoid the need to call pkg-config.
請安裝
libnss3-dev
即可。
make -j N
make install
libusb-1.0.18 安裝步驟:
tar xfva libusb-1.0.18.tar.bz2
cd libusb-1.0.18
./configure
make -j N
#make install
usbredir-0.7 安裝步驟:
tar xfva usbredir-0.7.tar.bz2
cd usbredir-0.7
./configure
make -j N
#make install
spice-protocol-0.12.7 安裝
tar xfva spice-protocol-0.12.7.tar.bz2
cd spice-protocol-0.12.7
./configure
make -j N
#make install
#cp /usr/local/share/pkgconfig/spice-protocol.pc /usr/lib/pkgconfig/
pixman 安裝步驟:
tar xfva pixman-0.28.2.tar.gz
cd pixman-0.28.2
./autogen
./configure
make -j N
# make install
celt 安裝步驟:
請注意 SPICE 只接受 CELT 0.51 版,因此不要安裝比此新的版本:
wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz
tar xfv celt-0.5.1.3.tar.gz
cd celt-0.5.1.3
./configure
make -j N
#make install
cd /usr/local/lib/pkgconfig
/usr/local/lib/pkgconfig# ln -s celt.pc celt051.pc
spice
spice 安裝步驟:
tar xfva spice-0.12.5.tar.bz2
cd spice-0.12.5
./configure --enable-smartcard
但是執行此指令不一定能順利執行,大多數的情況下會有錯誤,我們要一一處理,例如:
錯誤訊息:
checking for CELT051... no
configure: error: Package requirements (celt051 >= 0.5.1.1) were not met:
No package 'celt051' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables CELT051_CFLAGS
and CELT051_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
如果遇上以上錯誤訊息的話請先安裝先前所提到的 celt 0.51 套件:
錯誤訊息:
checking for pyparsing python module... not found
configure: error: pyparsing python module is required to compile this package
請安裝底下套件:
python-pyparsing
即可。
錯誤訊息:
checking sasl/sasl.h usability... no
checking sasl/sasl.h presence... no
checking for sasl/sasl.h... no
checking for sasl_client_init in -lsasl2... no
checking for sasl_client_init in -lsasl... no
configure: error: Missing required Cyrus SASL development package
請安裝底下套件:
libsasl2-dev
即可
錯誤訊息:
checking for SMARTCARD... no
configure: error: Package requirements (libcacard >= 0.1.2) were not met:
No package 'libcacard' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables SMARTCARD_CFLAGS
and SMARTCARD_LIBS to avoid the need to call pkg-config.
請依先前步驟安裝 libcacard 0.1.2 即可。
qemu
tar xfva qemu-linaro-1.7.0-2014.01.tar.gz
cd qemu-linaro-1.7.0-2014.01
./configure
time make -j 4
su
# make install
安裝完畢後可以執行底下指令來看看 qemu-linaro 版是否能正確執行:
qemu-system-arm -version
如果出現底下錯誤訊息的話,表示動態連結函式庫沒設定好:
qemu-system-arm: error while loading shared libraries: libspice-server.so.1: cannot open shared object file: No such file or directory
請以 root 權限執行:
# ldconfig
再回到一般使用者權限即可執行:
$ qemu-system-arm -version
QEMU emulator version 1.7.0 (qemu-linaro 2014.01), Copyright (c) 2003-2008 Fabrice Bellard
訂閱:
文章 (Atom)