tag:blogger.com,1999:blog-86292008613508823912024-02-08T01:01:41.107+08:00Disney 的學習筆記永遠學不完,每天都能發現新奇的事物~OneStepOneMove FPVhttp://www.blogger.com/profile/15030991111007927281noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8629200861350882391.post-27684064093843642252015-02-09T14:47:00.001+08:002015-07-08T10:56:29.386+08:00Linux Debian - 使用 apt-ftparchive 工具架設套件庫(APT Repository)本篇略簡為個人架設 Repository 之筆記,僅供參考。<br />
<br />
<div style="text-align: center;">
<b style="font-size: 40px;">---Create own APT Repository---</b></div>
<br />
<div style="text-align: start;">
<b><span style="font-size: 18px;">爬了許多文,為架設 repository 據我所知有兩大工具,reprepro 與 apt-ftparchive,</span></b></div>
<div style="text-align: start;">
<b><span style="font-size: 18px;">稍微研究過 reprepro 但是比起 ftparchive 操作方式複雜了許多,</span></b></div>
<div style="text-align: start;">
<b><span style="font-size: 18px;">所以暫時先使用 ftparchive 來架設。</span></b></div>
<div style="text-align: start;">
<b><span style="font-size: 18px;"><br />
</span></b></div>
<div style="text-align: start;">
<b><span style="font-size: 18px;">首先在你喜好的目錄下建立一個 Repository directory ,</span></b></div>
<div style="text-align: start;">
<b><span style="font-size: 18px;">個人是建立在家目錄底下 如下,</span></b></div>
<div style="text-align: start;">
<code>[root@debian] ~ <br />
→mkdir /home/repository<br />
[root@debian] ~ <br />
→cd /home/repositroy<br />
</code></div>
<br />
<b><span style="font-size: 18px;">接下來需要建立 ftparchive 所需的設定檔,generate.conf 與 release.conf。</span></b><br />
<b><span style="font-size: 18px;">建立一個 conf 目錄。</span></b><br />
<code><br />
[root@debian] /home/repository<br />
→mkdir conf<br />
[root@debian] /home/repository<br />
→cd conf<br />
[root@debian] /home/repository/conf<br />
→touch generate.conf release.conf<br />
</code><br />
<br />
<b><span style="font-size: x-large;">generate.conf</span></b><br />
<code>Dir {<br />
ArchiveDir ".";<br />
CacheDir ".";<br />
};<br />
<br />
Default {<br />
Packages::Compress ". gzip bzip2";<br />
Sources::Compress "gzip bzip2";<br />
Contents::Compress "gzip bzip2";<br />
};<br />
<br />
TreeDefault::Directory "pool";<br />
TreeDefault::SrcDirectory "pool";<br />
<br />
BinDirectory "pool" {<br />
Packages "dists/unstable/main/binary-amd64/Packages";<br />
Contents "dists/unstable/Contents-amd64";<br />
SrcPackages "dists/unstable/main/source/Sources";<br />
};<br />
<br />
BinDirectory "pool" {<br />
Packages "dists/unstable/main/binary-i386/Packages";<br />
Contents "dists/unstable/Contents-i386";<br />
SrcPackages "dists/unstable/main/source/Sources";<br />
};<br />
<br />
Tree "dists/unstable" {<br />
Sections "main";<br />
Architectures "i386 amd64 source";<br />
};<br />
<br />
Default {<br />
Packages {<br />
Extensions ".deb";<br />
};<br />
};<br />
</code><br />
<br />
<span style="font-size: x-large;"><b>release.conf</b></span><br />
<code>APT::FTPArchive::Release::Origin "<span style="color: red;">disney</span>";<br />
APT::FTPArchive::Release::Label "unstable";<br />
APT::FTPArchive::Release::Suite "unstable";<br />
APT::FTPArchive::Release::Codename "jessie";<br />
APT::FTPArchive::Release::Architectures "i386 amd64 source";<br />
APT::FTPArchive::Release::Components "main";<br />
APT::FTPArchive::Release::Description "<span style="color: red;">hr hr hr hr hr~~</span>";<br />
</code><br />
<br />
<span style="font-size: 18px;"><b>這兩個設定檔加入之後,這裡提供一個已寫好的 shell script,</b></span><br />
<span style="font-size: 18px;"><b>在 repository 目錄下建立目錄 bin,進入 bin 目錄並建立檔案 update.sh 。</b></span><br />
<code>[root@debian] /home/repository/conf <br />
→mkdir /home/repositroy/bin<br />
[root@debian] /home/repository/conf <br />
→cd /home/repository/bin<br />
</code><br />
<br />
<span style="font-size: x-large;"><b>update.sh</b></span><br />
<code>#!/bin/bash<br />
<br />
BASEDIR=$(dirname $0)/../web<br />
<br />
pushd $BASEDIR > /dev/null<br />
<br />
rm -fr dists<br />
mkdir -p pool<br />
mkdir -p dists/unstable/main/binary-amd64<br />
mkdir -p dists/unstable/main/binary-i386<br />
mkdir -p dists/unstable/main/source<br />
<br />
apt-ftparchive generate ../conf/generate.conf<br />
apt-ftparchive -c ../conf/release.conf release dists/unstable/ > dists/unstable/Release<br />
<br />
gpg -abs --homedir ~/.gnupg --default-key <span style="color: red;">E57952A1</span> -o dists/unstable/Release.gpg dists/unstable/Release<br />
<br />
popd > /dev/null<br />
</code><br />
<br />
<span style="font-size: 18px;"><b>在 repositroy 目錄底下建立 web 目錄,以上 script 需要用到的。</b></span><br />
<code>[root@debian] ~ <br />
→mkdir /home/repositroy/web<br />
</code><br />
<br />
<span style="font-size: 18px;"><b>接下來執行 update.sh ,將會自動建立套件庫所需目錄及檔案。</b></span><br />
<code>[root@debian] ~<br />
→cd /home/repository/bin<br />
[root@debian] ~ <br />
→bash update.sh<br />
</code><br />
<br />
<span style="font-size: 18px;"><b>將出現類似以下訊息。</b></span><br />
<code> pool: New 1,736 B 1 files 6,554 kB 0s<br />
pool: New 1,736 B 1 files 6,554 kB 0s<br />
pool: 0 files 0 B 0s<br />
pool: New 34 B 0 pkgs in 0s<br />
Packages done, Starting contents.<br />
dists/unstable/Contents-i386: New 34 B 0 files 0 B 0s<br />
dists/unstable/main/Contents-amd64: New 1,369 B 1 files 6,554 kB 0s<br />
dists/unstable/main/Contents-i386: New 34 B 0 files 0 B 0s<br />
Done. 13.1 MB in 2 archives. Took 0s<br />
<br />
你需要用密語來解開下列使用者的<br />
私鑰: "Disney <abc57911@gmail.com>"<br />
2048 位元長的 RSA 金鑰, ID E57952A1, 建立於 2015-02-04<br />
<br />
請輸入密語: <br />
</code><br />
<br />
<span style="font-size: 18px;"><b>上面訊息之中,所要求的金鑰,必須自行先建立,</b></span><br />
<span style="font-size: 18px;"><b>在這裡我提供網址給各位做參考,<a href="https://gentoo-handbook.lugons.org/doc/zh_tw/gnupg-user.xml" target="_blank">GnuPG Gentoo 使用者指南</a> 。</b></span><br />
<span style="font-size: 18px;"><b>而 update.sh 之中 gpg 指令的參數 --default-key 必須修改為自己所產生的 key,</b></span><br />
<span style="font-size: 18px;"><b>以指令 gpg --list-key 查看。</b></span><br />
<br />
<span style="font-size: 18px;"><b>套件庫建立完成之後,就差 nginx 的設定。</b></span><br />
<code><span style="font-family: monospace;">server {</span><br />
<span style="font-family: monospace;"> server_name ftp.disney.com;</span><br />
<span style="font-family: monospace;"><br />
</span> <span style="font-family: monospace;"> location /web/ {</span><br />
<span style="font-family: monospace;"> autoindex on;</span><br />
<span style="font-family: monospace;"> alias /home/repository/web/;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;">}</span></code><br />
<div>
<br /></div>
<br />
<span style="font-size: 18px;"><b>在 source.list 增加套件庫網址即可使用,在 /etc/apt/ 目錄底下。</b></span><br />
<code>deb http://ftp.disney.com/web/ unstable main</code>OneStepOneMove FPVhttp://www.blogger.com/profile/15030991111007927281noreply@blogger.com0tag:blogger.com,1999:blog-8629200861350882391.post-31595335312957646662014-12-19T13:55:00.005+08:002015-03-06T11:02:59.062+08:00Linux Debian - Java-JDK 8 安裝及設定<div style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;"><span style="background-color: white;">先大概介紹一下 SDK、JDK、JRE、JVM。</span><br />
<div style="font-size: 12px;"><span style="background-color: white; font-size: 12pt;"><br />
</span></div><div style="font-size: 12px;"><br />
</div></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"><span style="background-color: white; font-size: 12pt;"><strong>SDK(Software Develop Kit,軟件開發工具包)</strong>:<span style="color: #444444;">用於幫助開發人員的提高工作效率。各種不同類型的軟件開發,都可以有自己的 SDK。Windows 有 Windows SDK,DirectX 有 DirectX 9 SDK,.NET開發也有 Microsoft .NET Framework SDK。JAVA 開發也不含糊,也有自己的 Java SDK。</span></span><br />
<span style="background-color: white; font-size: 12pt;"><br />
</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"><span style="background-color: white; font-size: 12pt;"><strong>Java SDK(JDK)</strong>:<span style="color: #444444;">最早叫 Java Software Develop Kit,後來改名為 JDK,即 Java Develop Kit。JDK 作為 Java 開發工具包,主要用於構建在 Java 平台上運行的應用程序、Applet 和組件等。</span></span><br />
<span style="background-color: white; font-size: 12pt;"><br />
</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"><span class="" style="background-color: white; font-size: 12pt;"><strong>JRE(Java Runtime Environment,Java 運行環境)</strong>:<span style="color: #444444;">也就是 Java 平台。所有的 Java 程序都要在 JRE 下才能運行。JDK 的工具也是 Java 程序,也需要 JRE 才能運行。為了保持 JDK 的獨立性和完整性,在 JDK 的安裝過程中,JRE 也是安裝的一部分。所以,在 JDK 的安裝目錄下有一個名為 jre 的目錄,用於存放 JRE 文件。</span></span><br />
<span class="" style="background-color: white; font-size: 12pt;"><br />
</span></div><div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"><span style="background-color: white; font-size: 12pt;"><strong>JVM(Java Virtual Machine,Java 虛擬機)</strong>:<span style="color: #444444;">是 JRE 的一部分。它是一個虛構出來的計算機,是通過在實際的計算機上仿真模擬各種計算機功能來實現的。JVM 有自己完善的硬件架構,如處理器、堆棧、寄存器等,還具有相應的指令系統。Java 語言最重要的特點就是跨平台運行。使用 JVM 就是為了支援與操作系統無關,實現跨平台。</span></span><br />
<span style="background-color: white; font-size: 12pt;"><span style="color: #444444;"><br />
</span></span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"><div style="text-align: right;"><span style="background-color: white; font-size: 12pt;">Java介紹之</span><span style="background-color: white; font-size: 12pt;">出處:</span><a href="http://www.anyiwa.com/?p=465" style="font-size: 12pt; text-decoration: none;" target="_blank" title="SDK-JDK-JRE-JVM的基本概念">安逸哇?(簡)</a></div><span style="background-color: white; font-size: 12pt;"><span style="color: #444444;"><br />
</span></span><br />
<span style="background-color: white; font-size: 12pt;"><span style="color: #444444;"></span></span><br />
<a name='more'></a><span style="background-color: white; font-size: 12pt;"><span style="color: #444444;"><br />
</span></span></div><div style="text-align: center;"><h3><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;"><b><span style="font-size: 26px;">開始安裝 Java</span></b></span></span><b style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;"><span style="font-size: 26px;">-</span></b><b style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;"><span style="font-size: 26px;">JDK </span></b><b style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;"><span style="font-size: 26px;">8 </span></b></h3></div><div><div style="font-size: 16px;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;"><b>官方載點:</b></span></span><b style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;"><a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" target="_blank">Java-JDK 8</a></b></div><div style="font-size: 16px;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;"><br />
</span></span> <span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;">本範例以 Debian jessie 64bit 為例,故下載 </span><span style="line-height: 18px;"><b>jdk-8u25-linux-x64.tar.gz</b>。</span></span></div><div style="font-size: 16px;"><br />
</div><div style="font-size: 16px;">安裝所需工具 <b>java-package</b></div><div style="font-size: 16px;"><code># apt-get install java-package</code></div><div style="font-size: 16px;"><br />
</div><div style="font-size: 16px;">接下來將 <span style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;">jdk-8u25-linux-x64.tar.gz 製作成 <b>二進制檔(deb)</b>,</span></div><div style="font-size: 16px;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span> <span style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px;">使用剛剛所安裝 java-package 提供的 <b>make-jpkg</b> command,</span></div><div style="font-size: 16px;"><code>$ make-jpkg jdk-8u25-linux-x64.tar.gz</code></div><div style="font-size: 16px;"><br />
</div><div style="font-size: 16px;">將會出現提示訊息,在此皆使用預設即可。<br />
設定完成後,就會開始製成 deb<br />
<code># make-jpkg jdk-8u25-linux-x64.tar.gz<br />
Creating temporary directory: /tmp/make-jpkg.lnBztRYlLb<br />
Loading plugins: /usr/share/java-package/common.sh /usr/share/java-package/javase.sh /usr/share/java-package/jdk-doc.sh /usr/share/java-package/jdk.sh /usr/share/java-package/jre.sh /usr/share/java-package/oracle-jdk-doc.sh /usr/share/java-package/oracle-jdk.sh /usr/share/java-package/oracle-jre.sh<br />
<br />
Detected Debian build architecture: amd64<br />
Detected Debian GNU type: x86_64-linux-gnu<br />
<br />
Detected product:<br />
Java(TM) Development Kit (JDK)<br />
Standard Edition, Version 8 Update 25<br />
Oracle(TM)<br />
Is this correct [Y/n]:<br />
<br />
Checking free diskspace: done.<br />
<br />
In the next step, the binary file will be extracted. Probably a<br />
license agreement will be displayed. Please read this agreement<br />
carefully. If you do not agree to the displayed license terms, the<br />
package will not be built.<br />
<br />
Press [Return] to continue:</code><br />
<br />
製作成功後,使用 dpkg 安裝 deb 檔<br />
<code># dpkg -i oracle-java8-jdk_8u25_amd64.deb</code><br />
<br />
設定使用 java8-jdk<br />
<code># update-alternatives --config java</code><br />
<br />
若原先已經有裝過其他 java 的版本,就必須選擇使用哪個版本。<br />
<code>sudo update-alternatives --config java<br />
替代項目 java(提供 /usr/bin/java)有 2 個選擇。<br />
<br />
選項 路徑 優先權 狀態<br />
------------------------------------------------------------<br />
* 0 /usr/lib/jvm/jdk-8-oracle-x64/jre/bin/java 318 自動模式<br />
1 /usr/lib/jvm/jdk-7-oracle-x64/jre/bin/java 317 手動模式<br />
2 /usr/lib/jvm/jdk-8-oracle-x64/jre/bin/java 318 手動模式<br />
<br />
按 [enter] 保留目前選項 [*],或輸入選項編號:0 </code><br />
<br />
若沒有,會出現訊息如下。<br />
<code>替換群組 java(提供 /usr/bin/java)只有一個替換項目:/usr/lib/jvm/jdk-8-oracle-x64/jre/bin/java<br />
無可設定。</code><br />
<br />
<b>這樣就安裝成功囉!!</b><br />
<b><br />
</b> 最後,你可能會需要將該網站的網址加入 Java 的白名單裡,設定如下。<br />
<code>$ cd /etc/alternatives/<br />
$ ./ControlPanel</code><br />
<br />
開啟 <b>Java控制面板 </b>> 點擊<b>「安全」</b>標籤 ><b>「編輯網站清單(S)」</b>,將你要瀏覽的網站網址加入即可。<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHqOIytUbhhHIlrwiWifuxvlyjrP1AZl0zl3bsc0ZjPhgO2suQRKcLLgX8jIH-YSwZ_OHvTCTcLeX07o_2TIogJjJscCZlkGJvOxbwwP_cUI7qVTYVP_Q8fAOoTffyeEAnTEiNUQ1KLHo/s1600/2014-12-19+13:47:09+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHqOIytUbhhHIlrwiWifuxvlyjrP1AZl0zl3bsc0ZjPhgO2suQRKcLLgX8jIH-YSwZ_OHvTCTcLeX07o_2TIogJjJscCZlkGJvOxbwwP_cUI7qVTYVP_Q8fAOoTffyeEAnTEiNUQ1KLHo/s1600/2014-12-19+13:47:09+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" height="400" width="347" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><br />
但是通常安裝完 Java 後,第一次瀏覽需要 Java 的網頁,需要做如下的設定。<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD7ZS0MgPmC8o-ytJHKuAbbx0AuPfWGEELWuY15QPmPH93eRKOEe4OxvzELUAPU-2MNPqaBTIF1lG0IRlAYlXt9asMjwou5bmKrTsO1SLYqHBLvU_SdMMn-qG8CGyVMP6Yht16TkI_mMM/s1600/2014-12-19+12:19:46+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD7ZS0MgPmC8o-ytJHKuAbbx0AuPfWGEELWuY15QPmPH93eRKOEe4OxvzELUAPU-2MNPqaBTIF1lG0IRlAYlXt9asMjwou5bmKrTsO1SLYqHBLvU_SdMMn-qG8CGyVMP6Yht16TkI_mMM/s320/2014-12-19+12:19:46+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" /></a></div><br />
點選<b>「授予權限」</b>之後將 <b>codebase.jar</b> 下載下來並執行。<br />
<code># java -jar codebase.jar</code><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKsLmcE3KLaXWMP8TQ7xcDc4z7x3kmZqd9ITOazKQ4QrVX6TgMQf_bCDRYCKg85ZjJ9wqah-mPearyTYgjxx_fRgCjPSdoYqzOKC1fbeyzRlW__Trmm77IlEMJolUen1l4TFZXjnP0Nfk/s1600/2014-12-19+12:23:44+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKsLmcE3KLaXWMP8TQ7xcDc4z7x3kmZqd9ITOazKQ4QrVX6TgMQf_bCDRYCKg85ZjJ9wqah-mPearyTYgjxx_fRgCjPSdoYqzOKC1fbeyzRlW__Trmm77IlEMJolUen1l4TFZXjnP0Nfk/s320/2014-12-19+12:23:44+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" /></a></div><br />
按下確定後會要求你重新啟動瀏覽器,就照做吧~<br />
<br />
and enjoy your Java~<br />
<br />
<br />
<b>補充說明:</b><br />
從 Chrome 版本 35 開始,已移除 Linux 平台的 NPAPI (Netscape Plug-in API) 支援。<br />
如需詳細資訊,請參閱 <a href="http://blog.chromium.org/2013/09/saying-goodbye-to-our-old-friend-npapi.html" target="_blank">Chrome and NPAPI</a> (blog.chromium.org)。<br />
對於 Linux 上的 Java,建議使用 Firefox 瀏覽器。<br />
<br />
<br />
<br />
</div></div></div><center><script src="http://js1.bloggerads.net/showbanner.aspx?blogid=20141219000005&charset=utf-8" type="text/javascript"></script></center>OneStepOneMove FPVhttp://www.blogger.com/profile/15030991111007927281noreply@blogger.com0tag:blogger.com,1999:blog-8629200861350882391.post-63927470978805333042014-12-09T14:16:00.000+08:002014-12-25T16:17:13.635+08:00Linux Debian - Vmware Debian 使用 debootstrap 安裝教學<br />
<br />
<span style="font-size: x-large;"></span><br />
<div style="text-align: center;">
<span style="font-size: x-large;"><b>debootstrap安裝</b></span></div>
<span style="font-size: x-large;">
</span>
<div>
<div style="font-size: 16px;">
<b>參考文章:</b></div>
<ul style="font-size: 16px;">
<li><a href="http://goo.gl/j7cirQ">http://goo.gl/j7cirQ</a></li>
<li><a href="http://www.linuxquestions.org/questions/debian-26/how-to-install-debian-using-debootstrap-4175465295/">http://www.linuxquestions.org/questions/debian-26/how-to-install-debian-using-debootstrap-4175465295/</a></li>
</ul>
<div style="font-size: 16px;">
<br /></div>
<div style="font-size: 16px;">
<b>Live CD下載:</b></div>
<ul style="font-size: 16px;">
<li><a href="http://live.debian.net/cdimage/release/stable/amd64/iso-hybrid/">http://live.debian.net/cdimage/release/stable/amd64/iso-hybrid/</a></li>
</ul>
<div style="font-size: 16px;">
<br /></div>
<div style="font-size: 16px;">
<br /></div>
<div style="font-size: 16px;">
<b>liveCD映像檔載入並進入desktop<br />
先安裝debootstrap</b></div>
<div style="font-size: 16px;">
<code> aptitude update<br />
aptitude install debootstrap<br />
</code> </div>
<div style="font-size: 16px;">
<br />
<a name='more'></a><br /></div>
<div style="font-size: 16px;">
<b>磁碟分割與格式化</b></div>
<div style="font-size: 16px;">
<b>磁碟格式化完成之後將其掛載至新建之目錄(本範例為/jdisney)</b><br />
<br />
<code> cfdisk <br />
mkfs.ext4 -L Debian /dev/sda1 <br />
mkswap /dev/sda2 <br />
mkdir /jdisney <br />
mount -t ext4 /dev/sda1 /jdisney <br />
</code> <br />
<br />
<b>開始使用debootstrap來安裝核心</b><br />
<br />
<code> debootstrap --include=linux-image-amd64,grub-pc --arch amd64 jessie /jdisney http://ftp.tw.debian.org/debian<br />
</code> <br />
<b>複製系統檔案到安裝的目錄下</b><br />
<br />
<code> cp /etc/mtab /jdisney/etc/mtab<br />
cp /etc/network/interfaces /jdisney/etc/network/interfaces<br />
</code> <br />
<b>從host端綁定虛擬文件至client端</b><br />
<br />
<code> mount -o bind /dev /jdisney/dev<br />
mount -o bind /dev/pts /jdisney/dev/pts<br />
mount -o bind /proc /jdisney/proc<br />
mount -o bind /sys /jdisney/sys<br />
</code> <br />
<b>進入client端</b><br />
<br />
<code> chroot /jdisney<br />
</code> <br />
<b>安裝與配置grub所需檔案。</b><br />
<br />
<code> cp /usr/lib/grub/i386-pc/* /boot/grub<br />
grub-install /dev/sda<br />
update-grub<br />
</code> <br />
<b>設定開機時要掛載的磁碟、檔案系統</b><br />
<br />
<code> vim /etc/fstab<br />
content:<br />
/dev/sda1 / ext4 defaults 0 1<br />
/dev/sda2 none swap sw 0 0<br />
proc /proc proc defaults 0 0<br />
</code> <br />
<b>※重要<br />
必須為client端root設定密碼,否則無法登入。</b><br />
<br />
<code> passwd<br />
adduser disney<br />
</code> </div>
<div style="font-size: 16px;">
<br /></div>
<div style="font-size: 16px;">
<br /></div>
<div style="font-size: 16px;">
------------------------------------------------------------------------------------------------------------<span style="background-color: white; color: #474747; font-family: 'Trebuchet MS', Trebuchet, sans-serif; font-size: 12.7272720336914px; line-height: 16.5454540252686px;">------------------------</span></div>
<span style="font-size: x-large;"></span><br />
<div style="text-align: center;">
<span style="font-size: x-large;"><b>Q&A</b></span></div>
<span style="font-size: x-large;">
</span>
<div style="font-size: 16px;">
<b>磁碟分割</b><br />
<br />
cfdisk<br />
<br />
<br />
<b>not found command : add-apt-repository 解決辦法</b><br />
<br />
apt-get install software-properties-common<br />
<br />
<br />
<b>auto-completion - Terminal使用TAB自動完成指令</b><br />
<br />
apt-get install bash-completion<br />
<br />
修改檔案 /etc/bash.bashrc ,移除#註解 <br />
<br />
<code> if ! shopt -oq posix; then<br />
if [ -f /usr/share/bash-completion/bash_completion ]; then<br />
. /usr/share/bash-completion/bash_completion<br />
elif [ -f /etc/bash_completion ]; then<br />
. /etc/bash_completion<br />
fi<br />
fi<br />
</code> <br />
<br />
重新執行 source ~/.bashrc<br />
<br />
<br />
<b>VMtools install (VM 驅動安裝)</b><br />
<br />
<br />
https://communities.vmware.com/thread/464033l<br />
<br />
<br />
<b>LANGUAGE 設定</b><br />
<br />
export LANGUAGE=zh_TW.UTF-8<br />
<br />
locales-gen zh_TW.UTF-8<br />
<br />
dpkg-reconfigure locales<br />
<br />
<br />
<b>source.list 自動生成</b><br />
<br />
http://debgen.simplylinux.ch/<br />
<br />
<br />
<b>設定時區</b><br />
<br />
sudo dpkg-reconfigure<br />
<br />
aptitude install ntpdate<br />
<br />
sudo ntpdate ntp.stu.edu.tw<br />
<br /></div>
</div>
<center>
<script src="http://js1.bloggerads.net/showbanner.aspx?blogid=20141219000005&charset=utf-8" type="text/javascript"></script></center>
OneStepOneMove FPVhttp://www.blogger.com/profile/15030991111007927281noreply@blogger.com0tag:blogger.com,1999:blog-8629200861350882391.post-11358980425323759602014-12-08T10:24:00.000+08:002014-12-20T02:52:14.975+08:00Linux Debian - Build Package (deb),製作 (deb) 套件簡易說明<b><span style="font-family: inherit;">安裝要製作 Package 所需套件 </span></b><br />
<ul>
<li><span style="font-family: inherit;">apt-get install dh-make debhelper fakeroot </span></li>
</ul>
<span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><b>建立並進入資料夾</b> </span><br />
<ul>
<li><span style="font-family: inherit;">mkdir <project name> </span></li>
<li><span style="font-family: inherit;">cd <project name> </span></li>
</ul>
<span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit;">使用 dh_make 建立套件包所需檔案之範本, <br />
Debian Package 所需四個檔案為 (changelog, control, dirs, rules) </span></b><br />
<span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"></span><br />
<a name='more'></a><span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit;"> 接下來修改內容: </span></b><br />
<div>
<b><span style="font-family: inherit;"><br />
changelog </span></b><br />
<code><span style="font-family: inherit;"> sublime-text-3-chewing (3065) unstable; urgency=low<br />
<br />
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP><br />
<br />
-- disney <abc57911@gmail.com> Wed, 03 Dec 2014 16:19:15 +0800<br />
</span></code></div>
<span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit;">control</span></b><br />
<code><span style="font-family: inherit;"> Source: sublime-text-3-chewing<b>(套件源碼名稱)</b><br />
Section: misc<b>(套件種類)</b><br />
Priority: optional<br />
Maintainer: disney <abc57911@gmail.com><br />
Build-Depends: debhelper (>= 9)<br />
Standards-Version: 3065<b>(套件版本)</b><br />
<br />
Package: sublime-text-3-chewing<b>(套件名稱)</b><br />
Architecture: any<br />
Depends: <br />
Description: This version has chewing plugin. (<b>摘要)</b><br />
<b> (</b><b>內容)</b><b><br />
</b> La La La~ La La La~ La La La~ La La La~ La La La~ <br />
La La La~ La La La~ La La La~ La La La~ <br />
La La La~ La La La~ La La La~ <br />
La La La~ La La La~ <br />
La La La~ <br />
</span></code><br />
<span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit;">dirs</span></b><br />
<code><span style="font-family: inherit;"> opt/sublime_text<br />
usr/share <br />
</span></code><br />
<span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit;">rules</span></b><br />
<code><span style="font-family: inherit;"> #!/usr/bin/make -f<br />
# See debhelper(7) (uncomment to enable)<br />
# output every command that modifies files on the build system.<br />
#DH_VERBOSE = 1<br />
<br />
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*<br />
DPKG_EXPORT_BUILDFLAGS = 1<br />
include /usr/share/dpkg/default.mk<br />
<br />
# see FEATURE AREAS in dpkg-buildflags(1)<br />
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all<br />
<br />
# see ENVIRONMENT in dpkg-buildflags(1)<br />
# package maintainers to append CFLAGS<br />
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic<br />
# package maintainers to append LDFLAGS<br />
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed<br />
<br />
<br />
# main packaging script based on dh7 syntax<br />
%:<br />
dh $@ <br />
<br />
# debmake generated override targets<br />
# This is example for Cmake (See http://bugs.debian.org/641051 )<br />
#override_dh_auto_configure:<br />
# dh_auto_configure -- \<br />
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)<br />
<br />
clean:<br />
dh_testdir<br />
dh_testroot<br />
dh_clean<br />
<br />
build:<br />
# Nothing to do<br />
<br />
binary: binary-arch binary-indep<br />
# Nothing to do<br />
<br />
binary-arch: <br />
# Nothing to do<br />
<br />
#install: build<br />
# dh_testdir<br />
# dh_testroot<br />
# dh_clean -k <br />
# dh_installdirs<br />
<br />
binary-indep:<br />
dh_testdir<br />
dh_installdirs<br />
<br />
# Custom package commands</span><br />
<span style="font-family: inherit;">cp -r --parents opt/* <span style="color: red;">debian/sublime-text-3-chewing/</span></span><br />
<span style="font-family: inherit;">cp -r --parents usr/* <span style="color: red;">debian/sublime-text-3-chewing/</span></span><br />
<span style="font-family: inherit;">gcc -shared -o <span style="color: red;">debian/sublime-text-3-chewing/</span>opt/sublime_text/libsublime-imfix.so <span style="color: red;">debian/sublime-text-3-chewing/</span>opt/sublime_text/sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC<br />
<br />
<br />
# Resuming debhelper scripts</span><br />
<span style="font-family: inherit;">dh_testroot</span><br />
<span style="font-family: inherit;">dh_installchangelogs</span><br />
<span style="font-family: inherit;">dh_installdocs</span><br />
<span style="font-family: inherit;">dh_fixperms</span><br />
<span style="font-family: inherit;">dh_compress</span><br />
<span style="font-family: inherit;">dh_gencontrol</span><br />
<span style="font-family: inherit;">dh_md5sums</span><br />
<span style="font-family: inherit;">dh_builddeb<br />
.PHONY: binary binary-arch binary-indep build clean<br />
</span></code><br />
<span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit; font-size: large;">※</span></b><br />
<ul>
<li><span style="font-family: inherit;">cp -r --parents opt/* <span style="color: red;">debian/sublime-text-3-chewing/</span></span></li>
<li><span style="font-family: inherit;">上面的 cp 目的地資料夾的意思,就像是你的 Linux 根目錄<span style="color: red;"> /</span></span></li>
<li><span style="font-family: inherit;">ex: rules 設定安裝目錄為 <span style="color: red;">debian/sublime-text-3/</span>opt/sublime_text/</span></li>
<li><span style="font-family: inherit;">安裝時將會把檔案放入 /opt/sublime_tex/ 目錄底下。</span></li>
</ul>
<span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit;">注意事項:</span></b><br />
<ul>
<li><span style="font-family: inherit;">將要包進去的檔案,放在與 debian 同層目錄裡(專案的根目錄),</span></li>
<li><span style="font-family: inherit;">且必須創建和指定安裝的目錄路徑相同。</span></li>
</ul>
<span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGL5SjOjS5frt_2O_Q5u-hwg_TDgviNLuc4xDYvFPLmLqWEaCMCxcgbwolRLHTt06rML6qs6a_ihRG03KmWVHIWLNtMePxfQXJ6VHcbaV0YMdbJNigI-5qy8trPQYr5oyosOLg9L1XXJI/s1600/2014-12-08+09:31:58+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGL5SjOjS5frt_2O_Q5u-hwg_TDgviNLuc4xDYvFPLmLqWEaCMCxcgbwolRLHTt06rML6qs6a_ihRG03KmWVHIWLNtMePxfQXJ6VHcbaV0YMdbJNigI-5qy8trPQYr5oyosOLg9L1XXJI/s1600/2014-12-08+09:31:58+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" /></a> </span><br />
<span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <b><span style="font-family: inherit;">製作 Package</span></b><br />
<ul>
<li><span style="font-family: inherit;">檔案皆設置完成後開始打包</span></li>
<li><span style="font-family: inherit;">移動到專案根目錄底下 cd ~/package/sublime-text-3-chewing</span></li>
<li><span style="font-family: inherit;"><b>dpkg-buildpackage -rfakeroot -b</b> #製作 package.deb。</span></li>
</ul>
<span style="font-family: inherit;"><br />
</span> <br />
<center>
<script src="http://js1.bloggerads.net/showbanner.aspx?blogid=20141219000005&charset=utf-8" type="text/javascript"></script></center>
<!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-3DAlRXxDQH8%2FVIT_rWiv2RI%2FAAAAAAAAAFY%2FZjlJFEw_C_c%2Fs1600%2F2014-12-08%252B09%253A31%253A58%252B%25E7%259A%2584%25E8%259E%25A2%25E5%25B9%2595%25E6%2593%25B7%25E5%259C%2596.png&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGL5SjOjS5frt_2O_Q5u-hwg_TDgviNLuc4xDYvFPLmLqWEaCMCxcgbwolRLHTt06rML6qs6a_ihRG03KmWVHIWLNtMePxfQXJ6VHcbaV0YMdbJNigI-5qy8trPQYr5oyosOLg9L1XXJI/s1600/2014-12-08+09:31:58+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" -->OneStepOneMove FPVhttp://www.blogger.com/profile/15030991111007927281noreply@blogger.com4