<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>中文亂碼 &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/%E4%B8%AD%E6%96%87%E4%BA%82%E7%A2%BC/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Tue, 18 Apr 2023 08:16:56 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>中文亂碼 &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>簡單兩招，解決解壓縮 zip 檔的亂碼問題</title>
		<link>https://noter.tw/7532/%e7%b0%a1%e5%96%ae%e5%85%a9%e6%8b%9b%ef%bc%8c%e8%a7%a3%e6%b1%ba%e8%a7%a3%e5%a3%93%e7%b8%ae-zip-%e6%aa%94%e7%9a%84%e4%ba%82%e7%a2%bc%e5%95%8f%e9%a1%8c/</link>
					<comments>https://noter.tw/7532/%e7%b0%a1%e5%96%ae%e5%85%a9%e6%8b%9b%ef%bc%8c%e8%a7%a3%e6%b1%ba%e8%a7%a3%e5%a3%93%e7%b8%ae-zip-%e6%aa%94%e7%9a%84%e4%ba%82%e7%a2%bc%e5%95%8f%e9%a1%8c/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Sun, 07 Jun 2020 05:09:28 +0000</pubDate>
				<category><![CDATA[應用分享]]></category>
		<category><![CDATA[技巧分享]]></category>
		<category><![CDATA[zip]]></category>
		<category><![CDATA[教學]]></category>
		<category><![CDATA[分享]]></category>
		<category><![CDATA[怎麼]]></category>
		<category><![CDATA[記下來]]></category>
		<category><![CDATA[解壓縮]]></category>
		<category><![CDATA[錯誤]]></category>
		<category><![CDATA[7zip]]></category>
		<category><![CDATA[亂碼]]></category>
		<category><![CDATA[特殊符號]]></category>
		<category><![CDATA[中文亂碼]]></category>
		<category><![CDATA[winrar]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=7532</guid>

					<description><![CDATA[<p>小蛙有時候在網路下載壓縮檔 zip，用 WinRAR 解壓縮的時候會噴出一堆錯誤，這篇記錄下該怎麼處理這問題。(注意：這邊提到的是 .zip 檔，不是 .rar 喔) 雖然噴出錯誤，但解壓縮的動作還是&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/7532/%e7%b0%a1%e5%96%ae%e5%85%a9%e6%8b%9b%ef%bc%8c%e8%a7%a3%e6%b1%ba%e8%a7%a3%e5%a3%93%e7%b8%ae-zip-%e6%aa%94%e7%9a%84%e4%ba%82%e7%a2%bc%e5%95%8f%e9%a1%8c/" data-wpel-link="internal">簡單兩招，解決解壓縮 zip 檔的亂碼問題</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>小蛙有時候在網路下載壓縮檔 zip，用 WinRAR 解壓縮的時候會噴出一堆錯誤，這篇記錄下該怎麼處理這問題。(注意：這邊提到的是 .zip 檔，不是 .rar 喔)</p>



<span id="more-7532"></span>



<p>雖然噴出錯誤，但解壓縮的動作還是會繼續進行，不過有檔名問題的檔案解出來有的會消失，有的會變成亂碼無法辨識或開啟，上網查了一些解法，看到 WinRAR 有調整編碼的功能，但是小蛙自己電腦上的 WinRAR 找不到這個功能。</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/ACtC-3cpVQn4WEkvG6F6VqPCyZdK5UFM6XROEenzERZ5GTrJpuKIQ0dkhkcwzeBIDnCKsJ_4Vj_S_yMYhUGaNkWoMMunN2lcJhgcJB74uY-ktZFw9BJAOu8wgwYSpmtFrAYJ3hvGTf1GrtvpcDyrAJwO1IbBlQ=w1305-h772-no?authuser=1" alt="ACtC 3cpVQn4WEkvG6F6VqPCyZdK5UFM6XROEenzERZ5GTrJpuKIQ0dkhkcwzeBIDnCKsJ 4Vj S yMYhUGaNkWoMMunN2lcJhgcJB74uY ktZFw9BJAOu8wgwYSpmtFrAYJ3hvGTf1GrtvpcDyrAJwO1IbBlQ=w1305 h772 no?authuser=1 簡單兩招，解決解壓縮 zip 檔的亂碼問題" title="簡單兩招，解決解壓縮 zip 檔的亂碼問題"></figure></div>



<p>突然想到小蛙家裡的電腦，沒有安裝 WinRAR，但是還是一樣可以把檔案解壓縮出來，於是做了一些測試，以下是小蛙自己實際使用成功的解決方法，不確定是否能適用於每一個人的狀況，但可以試試看。</p>



<h2 class="wp-block-heading">使用 7-zip</h2>



<p>小蛙家裡的電腦只有安裝 7-zip 沒有 WinRAR，記得同一個壓縮檔好像沒有遇到公司電腦遇到的問題，再次使用 7-zip 解壓縮同一個 zip 試試，結果真的可以正確解壓縮，完全沒有噴出任何錯誤！</p>



<h2 class="para wp-block-heading">使用 Windows 內建</h2>



<p>Windows 10 以上的系統，在 zip 壓縮檔上面點選滑鼠右鍵 -&gt; 解壓縮全部，接著選取要解壓縮到的目錄，即會進行解壓縮，過程也可以順利解完，不會出現上述錯誤。</p>



<p>或者也可以直接在 zip 壓縮檔上點選滑鼠左鍵兩下，會開出一個檔案總管視窗，裡面是壓縮檔的內容，把要解壓縮的檔案框選起來，或是 ctrl + a 選擇所有檔案，點選左鍵把這些檔案拖曳到要解壓縮的資料夾裡就可以囉！</p>



<p><strong>Windows 相關文章</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/10439/windows-%e8%a4%87%e8%a3%bd%e6%89%80%e6%9c%89%e6%aa%94%e6%a1%88%e5%90%8d%e7%a8%b1%ef%bc%8c%e4%bb%a5%e5%8f%8a-notepad-%e5%a4%9a%e6%ac%84%e9%81%b8%e5%8f%96%e5%8f%8a%e8%a4%87%e8%a3%bd%e5%8a%9f%e8%83%bd/" data-wpel-link="internal">Windows 複製所有檔案名稱，以及 Notepad++ 多欄選取及複製功能</a></li><li><a href="https://noter.tw/8636/windows-update-error/" data-wpel-link="internal">您的裝置缺少重要的安全性和品質的修正</a></li><li><a href="https://noter.tw/8573/printer/" data-wpel-link="internal">Windows 10 新增網路印表機</a></li><li><a href="https://noter.tw/8564/samba/" data-wpel-link="internal">重設 Windows 網路芳鄰 (Samba) 記憶密碼</a></li><li><a href="https://noter.tw/4539/windows-vpn-%e8%a8%ad%e5%ae%9a-%e4%bd%bf%e7%94%a8-softether-vpn/" data-wpel-link="internal">Windows VPN 設定</a></li><li><a href="https://noter.tw/2602/windows-%e8%a8%ad%e5%ae%9a-vpn-%e9%80%a3%e7%b7%9a/" data-wpel-link="internal">Windows 設定 VPN 連線</a></li><li><a href="https://noter.tw/8645/remove-trend-micro-security-agent/" data-wpel-link="internal">Trend Micro Security Agent 移除方法</a></li><li><a href="https://noter.tw/7532/%e7%b0%a1%e5%96%ae%e5%85%a9%e6%8b%9b%ef%bc%8c%e8%a7%a3%e6%b1%ba%e8%a7%a3%e5%a3%93%e7%b8%ae-zip-%e6%aa%94%e7%9a%84%e4%ba%82%e7%a2%bc%e5%95%8f%e9%a1%8c/" data-wpel-link="internal">簡單兩招，解決解壓縮 zip 檔的亂碼問題</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/7532/%e7%b0%a1%e5%96%ae%e5%85%a9%e6%8b%9b%ef%bc%8c%e8%a7%a3%e6%b1%ba%e8%a7%a3%e5%a3%93%e7%b8%ae-zip-%e6%aa%94%e7%9a%84%e4%ba%82%e7%a2%bc%e5%95%8f%e9%a1%8c/" data-wpel-link="internal">簡單兩招，解決解壓縮 zip 檔的亂碼問題</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/7532/%e7%b0%a1%e5%96%ae%e5%85%a9%e6%8b%9b%ef%bc%8c%e8%a7%a3%e6%b1%ba%e8%a7%a3%e5%a3%93%e7%b8%ae-zip-%e6%aa%94%e7%9a%84%e4%ba%82%e7%a2%bc%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</title>
		<link>https://noter.tw/396/ubuntu-16-04-%e8%a8%ad%e5%ae%9a%e7%92%b0%e5%a2%83%e8%aa%9e%e8%a8%80%e7%b7%a8%e7%a2%bc%ef%bc%8c%e8%ae%93%e4%b8%ad%e6%96%87%e5%8f%af%e4%bb%a5%e6%ad%a3%e5%b8%b8%e9%a1%af%e7%a4%ba/</link>
					<comments>https://noter.tw/396/ubuntu-16-04-%e8%a8%ad%e5%ae%9a%e7%92%b0%e5%a2%83%e8%aa%9e%e8%a8%80%e7%b7%a8%e7%a2%bc%ef%bc%8c%e8%ae%93%e4%b8%ad%e6%96%87%e5%8f%af%e4%bb%a5%e6%ad%a3%e5%b8%b8%e9%a1%af%e7%a4%ba/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Sat, 01 Dec 2018 07:57:13 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[中文亂碼]]></category>
		<category><![CDATA[.bashrc]]></category>
		<category><![CDATA[setlocale]]></category>
		<category><![CDATA[locale-gen]]></category>
		<category><![CDATA[update-locale]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=396</guid>

					<description><![CDATA[<p>有了自己的域名，申請了 VPS，在 VPS 中安裝了 Ubuntu 之後，就來開始進行設定，小蛙用比較久的版本是 Ubuntu 16.04 (64 bit)，可以發現除了早期有 Ubuntu 12.0&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/396/ubuntu-16-04-%e8%a8%ad%e5%ae%9a%e7%92%b0%e5%a2%83%e8%aa%9e%e8%a8%80%e7%b7%a8%e7%a2%bc%ef%bc%8c%e8%ae%93%e4%b8%ad%e6%96%87%e5%8f%af%e4%bb%a5%e6%ad%a3%e5%b8%b8%e9%a1%af%e7%a4%ba/" data-wpel-link="internal">Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>

有了自己的域名，申請了 VPS，在 VPS 中安裝了 Ubuntu 之後，就來開始進行設定，小蛙用比較久的版本是 Ubuntu 16.04 (64 bit)，可以發現除了早期有 Ubuntu 12.04 或是一些其他狀況需要碰到 CentOS，不然大多使用自己熟悉的 Ubuntu 16.04。

</p>



<span id="more-396"></span>



<script type="application/ld+json">{    "@context": "http://schema.org",        "@type": "VideoObject",    "name": "【 Ubuntu 相關 】Ubuntu 16 04 設定環境語言編碼，讓中文可以正常顯示",    "description": "請開啟 CC 字幕  完整文章內容請參考：https://noter.tw/396 （記下來 - 專業偽筆記）",    "thumbnailUrl": "https://img.youtube.com/vi/6HOw_BMuKxc/sddefault.jpg",    "uploadDate": "2018-12-06T09:36:19Z",    "duration": "PT1M26S",    "contentUrl": "https://www.youtube.com/watch?v=0blDh7s62Pw"}</script>




<div class="wp-block-image"><figure class="aligncenter"><img fetchpriority="high" decoding="async" width="673" height="380" src="https://noter.tw/wp-content/uploads/vim_garbled.png" alt="vim garbled Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示" class="wp-image-425" title="Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示" srcset="https://noter.tw/wp-content/uploads/vim_garbled.png 673w, https://noter.tw/wp-content/uploads/vim_garbled-300x169.png 300w" sizes="(max-width: 673px) 100vw, 673px" /></figure></div>



<p>

預設安裝好 Ubuntu 16.04 後的編碼應該是 en_US，所以如果透過 Pietty SSH 進去主機會發現很多中文的部份沒辦法正確呈現，甚至嚴重一點的會讓 vim 沒辦法正常使用，這篇記錄一下怎麼解決的這個問題。

</p>



<h2 class="para wp-block-heading">手動設定 .bashrc</h2>



<p>

.bashrc 這檔案會在每個使用者的家目錄中，如：<code>/root/.bashrc</code>、<code>/home/xxxx/.bashrc</code>，每次只要有 ssh 遠端登入時，就會載入該使用者家目錄下的 .bashrc。

</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">############## 顯示中文問題 ##################
// 編輯自己家目錄下的 bash 環境
vim .bashrc
// 在最下面加入這些設定
export LANGUAGE="zh_TW.UTF-8"
export LANG="zh_TW.UTF-8"
export LC_ALL="zh_TW.UTF-8"
// 使用 source 讓設定檔生效時，發生以下錯誤
source .bashrc
-bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
// 透過 locale-gen 產生 zh_TW.UTF-8 的語系
sudo locale-gen zh_TW.UTF-8
sudo update-locale LANG=zh_TW.UTF-8
// 完成後重新登入即可</pre>



<h2 class="para wp-block-heading">使用腳本自動設定 .bashrc</h2>



<p>

也可以直接把上面的功能寫成一個腳本

</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">#!/bin/bash
apt-get update
apt-get install -y locales
locale-gen zh_TW.UTF-8
echo 'export LANGUAGE="zh_TW.UTF-8"' &gt;&gt; /root/.bashrc
echo 'export LANG="zh_TW.UTF-8"' &gt;&gt; /root/.bashrc
echo 'export LC_ALL="zh_TW.UTF-8"' &gt;&gt; /root/.bashrc
update-locale LANG=zh_TW.UTF-8</pre>



<p>

複製上面的內容存成 setLang.sh，接著

</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">chmod +x setLang.sh
./setLang.sh  
source /root/.bashrc</pre>



<p> 等他跑完就可以正常顯示中文囉！附上影片，小蛙的 <a rel="noreferrer noopener nofollow external" href="https://www.youtube.com/channel/UCy6ZklcNv5fmqy6USd2FgQg/" target="_blank" data-wpel-link="external" class="wpel-icon-right">YouTube 頻道 &#8211; 記下來<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 還有更多不同主題的影片，有興趣可以過去看看！ </p>



<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<div class="video-container"><iframe title="Ubuntu 設定環境語言編碼，讓中文可以正常顯示 | 記下來" width="500" height="375" src="https://www.youtube.com/embed/6HOw_BMuKxc?feature=oembed&#038;wmode=opaque" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
</div></figure>



<p><strong>網站架設系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/10151/%e7%9b%a4%e9%bb%9e%e9%82%a3%e4%ba%9b%e6%9b%be%e7%b6%93%e9%99%aa%e4%bc%b4%e9%81%8e%e5%b0%8f%e8%9b%99%e7%9a%84-vps-%e8%99%9b%e6%93%ac%e4%b8%bb%e6%a9%9f/" data-wpel-link="internal">盤點那些曾經陪伴過小蛙的 VPS 虛擬主機</a></li><li><a href="https://noter.tw/176/%e5%a6%82%e4%bd%95%e6%8c%91%e9%81%b8-vps-%e6%9c%80%e5%88%92%e7%ae%97%e7%9a%84%e8%b2%b7%e6%b3%95/" data-wpel-link="internal">如何挑選 VPS + 最划算的買法</a></li><li><a href="https://noter.tw/406/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%A6%82%E4%BD%95%E8%B3%BC%E8%B2%B7-vps/" data-wpel-link="internal">手把手教你如何購買 VPS</a></li><li><a href="https://noter.tw/4463/第一次買-kvm-虛擬主機/" data-wpel-link="internal">第一次買 KVM 虛擬主機</a></li><li><a href="https://noter.tw/4242/%e8%a1%80%e7%9a%84%e6%95%99%e8%a8%93-hiformance-%e8%b7%91%e8%b7%af%e4%ba%86/" data-wpel-link="internal">血的教訓 &#8211; HiFormance 跑路了 &#8230;</a></li><li><a href="https://noter.tw/196/%e7%82%ba%e8%87%aa%e5%b7%b1%e7%94%b3%e8%ab%8b%e4%b8%80%e5%80%8b%e5%9f%9f%e5%90%8d-hinet-%e7%82%ba%e4%be%8b/" data-wpel-link="internal">為自己申請一個域名 – HiNet 為例</a></li><li><a href="https://noter.tw/117/cloudflare-%E8%B6%85%E5%BC%B7%E5%A4%A7%E7%9A%84%E5%85%8D%E8%B2%BB-cdn/" data-wpel-link="internal">Cloudflare – 超強大的免費 CDN (?)</a></li><li><a href="https://noter.tw/195/%e4%bd%bf%e7%94%a8-cloudflare-%e4%bb%a3%e7%ae%a1%e4%bd%a0%e7%9a%84%e5%9f%9f%e5%90%8d/" data-wpel-link="internal">使用 Cloudflare 代管你的域名</a></li><li><a href="https://noter.tw/396/ubuntu-16-04-設定環境語言編碼，讓中文可以正常顯示/" data-wpel-link="internal">Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</a></li><li><a href="https://noter.tw/255/ubuntu-16-04-%e5%ae%89%e8%a3%9d-fail2ban/" data-wpel-link="internal">Ubuntu 16.04 安裝 fail2ban</a></li><li><a href="https://noter.tw/436/%E4%B8%80%E5%80%8B%E8%85%B3%E6%9C%AC%E6%AF%8F%E5%A4%A9%E8%87%AA%E5%8B%95%E5%82%99%E4%BB%BD/" data-wpel-link="internal">一個腳本每天自動備份</a></li><li><a href="https://noter.tw/32/linux-tar-%E5%AE%8C%E6%95%B4%E5%82%99%E4%BB%BD%E3%80%81%E5%A2%9E%E9%87%8F%E5%82%99%E4%BB%BD%E5%8F%8A%E5%B7%AE%E7%95%B0%E5%82%99%E4%BB%BD%E6%AF%94%E8%BC%83/" data-wpel-link="internal">Linux tar 完整備份、增量備份及差異備份比較</a></li><li><a href="https://noter.tw/3704/nginx-ssl-certificate-%E8%AE%93-http-%E8%AE%8A%E8%BA%AB%E6%88%90%E7%82%BA-https/" data-wpel-link="internal">nginx + SSL Certificate – 讓 http 變身成為 https</a></li><li><a href="https://noter.tw/3695/ssl-for-free-%E5%85%8D%E8%B2%BB%E5%8F%88%E6%9C%89%E7%B6%A0%E8%89%B2%E9%8E%96%E9%A0%AD%E7%9A%84-ssl-certificates/" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a></li><li><a href="https://noter.tw/8596/certbot-error/" data-wpel-link="internal">Certbot 申請 SSL certificate 錯誤問題</a></li><li><a href="https://noter.tw/9107/certbot-error-acmev1-is-deprecated/" data-wpel-link="internal">Certbot 錯誤：ACMEv1 is deprecated and you can …</a></li><li><a href="https://noter.tw/5967/ubuntu-18-04-%e5%ae%89%e8%a3%9d-awstats-%e4%be%86%e7%b5%b1%e8%a8%88%e7%b6%b2%e7%ab%99%e6%b5%81%e9%87%8f/" data-wpel-link="internal">Ubuntu 18.04 安裝 AWStats 來統計網站流量</a></li><li><a href="https://noter.tw/9287/pchome-%e8%b2%b7%e7%b6%b2%e5%9d%80%e7%ba%8c%e7%b4%84%e6%b5%81%e7%a8%8b/" data-wpel-link="internal">PCHome 買網址續約流程</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/396/ubuntu-16-04-%e8%a8%ad%e5%ae%9a%e7%92%b0%e5%a2%83%e8%aa%9e%e8%a8%80%e7%b7%a8%e7%a2%bc%ef%bc%8c%e8%ae%93%e4%b8%ad%e6%96%87%e5%8f%af%e4%bb%a5%e6%ad%a3%e5%b8%b8%e9%a1%af%e7%a4%ba/" data-wpel-link="internal">Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/396/ubuntu-16-04-%e8%a8%ad%e5%ae%9a%e7%92%b0%e5%a2%83%e8%aa%9e%e8%a8%80%e7%b7%a8%e7%a2%bc%ef%bc%8c%e8%ae%93%e4%b8%ad%e6%96%87%e5%8f%af%e4%bb%a5%e6%ad%a3%e5%b8%b8%e9%a1%af%e7%a4%ba/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>中文亂碼總整理 (Tomcat 5.5)</title>
		<link>https://noter.tw/2902/%e4%b8%ad%e6%96%87%e4%ba%82%e7%a2%bc%e7%b8%bd%e6%95%b4%e7%90%86-tomcat-5-5/</link>
					<comments>https://noter.tw/2902/%e4%b8%ad%e6%96%87%e4%ba%82%e7%a2%bc%e7%b8%bd%e6%95%b4%e7%90%86-tomcat-5-5/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Mon, 03 Jun 2013 15:21:55 +0000</pubDate>
				<category><![CDATA[網頁後端]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[亂碼]]></category>
		<category><![CDATA[中文亂碼]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[charset]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=2902</guid>

					<description><![CDATA[<p>之前舊的部落格發過幾篇解決 Tomcat 中文亂碼問題的文章，確實是解決了一些中文顯示的問題，但今天在 Struts2 時，又再度遇到中文亂碼的問題，所以想把幾個可能忽略的步驟記錄下來。 其實解決中文&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2902/%e4%b8%ad%e6%96%87%e4%ba%82%e7%a2%bc%e7%b8%bd%e6%95%b4%e7%90%86-tomcat-5-5/" data-wpel-link="internal">中文亂碼總整理 (Tomcat 5.5)</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>之前舊的部落格發過幾篇解決 Tomcat 中文亂碼問題的文章，確實是解決了一些中文顯示的問題，但今天在 Struts2 時，又再度遇到中文亂碼的問題，所以想把幾個可能忽略的步驟記錄下來。</p>



<span id="more-2902"></span>



<p>其實解決中文亂碼，只要把所有的編碼格式都調整成一致，比如說，編輯器預設儲存編碼為 Big5，卻把頁面設定成 <code>&lt;%@ page contentType="text/html; charset=utf-8" %></code>，這樣一來，在瀏覽器開啟的網頁，中文就會是亂碼。(反過來也會是亂碼)。唯有兩者設定都是相同編碼的時候，在網頁上才能正確顯示中文。</p>



<p>上面提到，把所有的編碼都設成 Big5，這麼一來，也符合了「所有編碼都設為相同」的原則，當然包括編輯器預設儲存編碼也是 Big5，如此網頁可以正確顯示中文字，但是 &#8230; 如果後端需要加上 MySQL 資料庫，如何在表單跟 MySQL 之間正確傳遞中文，可能又會是一個花時間的問題，經過幾番折騰之後，決定把所有的編碼都設定為 utf-8 比較方便。</p>


<div id="rank-math-howto" class="rank-math-block" >
<div class="rank-math-howto-description">

</div>

<div class="rank-math-steps ">
<div id="howto-step-643e51f888560" class="rank-math-step">
<h3 class="rank-math-step-title ">編輯器預設儲存編碼 => 設定成 <strong>UTF-8</strong></h3>
<div class="rank-math-step-content "><p>以 EditPlus3 為例，可從「工具」->「偏好項」->「檔案」->「預設編碼模式」改成 UTF-8，<br />注意之前可能存成 Big5 的，可以按另存新檔後，最下面編碼模式可以改變。</p>
</div>
</div>
<div id="howto-step-643e51f888562" class="rank-math-step">
<h3 class="rank-math-step-title ">每個 JSP 頁面 charset 設定成 UTF-8</h3>
<div class="rank-math-step-content "><p>e.g. &lt;%@ page contentType=&#8221;text/html; charset=utf-8&#8243; %></p>
</div>
</div>
<div id="howto-step-643e51f888563" class="rank-math-step">
<h3 class="rank-math-step-title ">MySQL my.ini 設定成</h3>
<div class="rank-math-step-content ">[client]default-character-set=utf8<br />[mysqld]default-character-set=utf8</p>
</div>
</div>
<div id="howto-step-643e51f888564" class="rank-math-step">
<h3 class="rank-math-step-title ">資料庫、資料表及欄位的 <strong>character-set</strong> 設為 utf8，<strong>collation</strong>(校對)設定為utf8_unicode_ci。</h3>
<div class="rank-math-step-content "></div>
</div>
<div id="howto-step-643e51f888565" class="rank-math-step">
<h3 class="rank-math-step-title "><strong>資料庫連結部份</strong>修改</h3>
<div class="rank-math-step-content "><p>Connection con=DriverManager.getConnection(&#8220;jdbc:mysql://localhost/user?useUnicode=true&amp;characterEncoding=utf8&#8221;, &#8220;帳號&#8221;, &#8220;密碼&#8221;);</p>
</div>
</div>
<div id="howto-step-643e51f888566" class="rank-math-step">
<h3 class="rank-math-step-title ">Servlet 部份同樣把 <strong>charset</strong> 設定成 UTF-8</h3>
<div class="rank-math-step-content "><p>e.g. request.setContentType(&#8220;text/html; charset=utf-8&#8221;);</p>
</div>
</div>
<div id="howto-step-643e51f888567" class="rank-math-step">
<h3 class="rank-math-step-title ">GET 亂碼解決</h3>
<div class="rank-math-step-content "><p>在 %TOMCAT_HOME%\conf\server.xml 中，找到&lt;connector port=&#8221;8080&#8243; &#8230; 部分，加上 URIEncoding = &#8220;UTF-8&#8243;，重啟 Tomcat。</p>
</div>
</div>
<div id="howto-step-643e51f888568" class="rank-math-step">
<h3 class="rank-math-step-title ">POST 亂碼解決</h3>
<div class="rank-math-step-content "><p>若是有多個網站，將 %TOMCAT_HOME%\webapps\jsp-examples\WEB-INF\classes\filters\SetCharacterEncodingFilter.class 複製到%TOMCAT_HOME%\shared\classes\filters 下，(若沒有資料夾可以自己新增)，修改 %TOMCAT_HOME%\webapps\(mytest)\WEB-INF\web.xml (mytest 為網站目錄)，加上以下內容 </p>
</div>
</div>
</div>
</div>


<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;filter> 
  &lt;filter-name>SetCharacterEncoding&lt;/filter-name> 
  &lt;filter-class>filters.SetCharacterEncodingFilter&lt;/filter-class> 
  &lt;init-param> 
    &lt;param-name>encoding&lt;/param-name> 
    &lt;param-value>Big5&lt;/param-value> 
  &lt;/init-param> 
&lt;/filter> 
&lt;filter-mapping> 
  &lt;filter-name>SetCharacterEncoding&lt;/filter-name> 
  &lt;url-pattern>/*&lt;/url-pattern> 
&lt;/filter-mapping></pre>



<p>照著這些步驟做，應該就能有個能正確顯示中文的平台(或許吧！至少小蛙現在的環境就是)如果發現什麼問題，再隨時補上。</p>



<p><strong>2009/07/31 補充：<br></strong>在使用 Prototype.js 的 Updater / Requester function 時，編碼為 big5 傳遞中文會發生亂碼，<br>PHP 的解決方式 -> <code>header("Content-Type:text/html;charset=BIG5");</code><br>JSP 解決方式 ->  <code>response.setHeader("Charset","BIG5"); </code><br>這裡 AJAX 的傳遞方式要用 get。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2902/%e4%b8%ad%e6%96%87%e4%ba%82%e7%a2%bc%e7%b8%bd%e6%95%b4%e7%90%86-tomcat-5-5/" data-wpel-link="internal">中文亂碼總整理 (Tomcat 5.5)</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/2902/%e4%b8%ad%e6%96%87%e4%ba%82%e7%a2%bc%e7%b8%bd%e6%95%b4%e7%90%86-tomcat-5-5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>VPS安裝記錄</title>
		<link>https://noter.tw/2223/vps%e5%ae%89%e8%a3%9d%e8%a8%98%e9%8c%84/</link>
					<comments>https://noter.tw/2223/vps%e5%ae%89%e8%a3%9d%e8%a8%98%e9%8c%84/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Wed, 09 May 2012 13:00:39 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VPS]]></category>
		<category><![CDATA[中文亂碼]]></category>
		<category><![CDATA[DirectSpace]]></category>
		<category><![CDATA[Dropbox]]></category>
		<category><![CDATA[心得]]></category>
		<category><![CDATA[ChicagoVPS]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=2223</guid>

					<description><![CDATA[<p>(2014-12-05 更新) 最近重灌VPS的次數有點多，總覺得要一直做同樣的事情很麻煩 &#8230; 記錄下來，雖然之後重灌也還是要下一堆指令，不過至少可以直接 copy paste ^__^ &#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2223/vps%e5%ae%89%e8%a3%9d%e8%a8%98%e9%8c%84/" data-wpel-link="internal">VPS安裝記錄</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>

(2014-12-05 更新) 最近重灌VPS的次數有點多，總覺得要一直做同樣的事情很麻煩 &#8230; 記錄下來，雖然之後重灌也還是要下一堆指令，不過至少可以直接 copy paste ^__^ 省了一些麻煩事。這是小蛙自己的VPS設定，最痛苦的第一次已經過去了，也忘的差不多了，小蛙透過<strong><a href="http://wazai.net/2166/%e5%ae%9a%e6%9c%9f%e5%82%99%e4%bb%bdwordpress%e5%88%b0dropbox" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">定期備份WordPress到Dropbox<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>做備份，因此之後的安裝(包括 lightppd.conf, my.cnf, php.ini &#8230; 等設定檔)就沿用舊的資料(要設定這些東西真的是太困難了 &#8230;)，這篇文章只記錄安裝套件、環境的操作及設定。

</p>



<span id="more-2223"></span>



<p> 2013-06-20</p>



<p>從&nbsp;<a rel="noreferrer noopener nofollow external" href="http://www.lowendbox.com/" target="_blank" data-wpel-link="external" class="wpel-icon-right">Low End Box<span class="wpel-icon wpel-image wpel-icon-6"></span></a>&nbsp;中看到不少人推薦 <strong><a rel="noreferrer noopener nofollow external" href="https://billing.chicagovps.net/aff.php?aff=723" target="_blank" data-wpel-link="external" class="wpel-icon-right">ChicagoVPS<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong> 並且找到 Coupon 之後就換了。到現在也已經一年左右了(有點忘了確切時間)，在線率還蠻高的，狀況也不多，這邊有幾個 ChicagoVPS 要注意的事情，小蛙最早買的是 RAM 1024 的，發現所有要跑的東西加上 crontab 執行的 Java 程式偶爾會有 crash 的情況(記憶體不足)，用了一段時間後，在 Low End Box 上看到有 2048 MB RAM 的優惠方案只要 $7 美金，比當時小蛙使用的便宜 &#8230; 有種被當冤大頭的樣子，二話不說馬上又是一陣忙碌，取消現有的註冊一個新的 $7 方案！</p>



<p>這個 $7 方案用了很久，直到昨天看到有每年 $55 美金的方案，小蛙 $7 方案的內容是：2048 MB RAM, 50G HD, 2T Bandwidth, 1 IPv4 &#8230; (<a rel="noreferrer noopener nofollow external" href="https://billing.chicagovps.net/aff.php?aff=723" target="_blank" data-wpel-link="external" class="wpel-icon-right">詳情<span class="wpel-icon wpel-image wpel-icon-6"></span></a>&nbsp;-&gt; OPENVZ VPS PLANS -&gt;&nbsp;Enterprise)，昨天看到的 $55 美金的內容是：3072 MB RAM, 120G HD, 3T Bandwidth, 2 IPv4 (<a rel="noreferrer noopener nofollow external" href="https://billing.chicagovps.net/aff.php?aff=723" target="_blank" data-wpel-link="external" class="wpel-icon-right">詳情<span class="wpel-icon wpel-image wpel-icon-6"></span></a>&nbsp;-&gt;整個網頁最下方有一個&nbsp;special promos)，重點來了以一整年來看 $7 * 12 = $84，$55 的方案價格上樂勝！規格上樂勝！而且還附贈原本要額外花錢購買的監控功能！一樣不用懷疑，準備&#8221;搬家&#8221;！ </p>



<p>2012-06-22</p>



<p>DirectSpace 真的令小蛙心寒，光六月份就已經掛點兩次，第一次大概一天左右，第二次停了 3~4 天，submit ticket 得到的回應是有一些 node 發生 routing 的問題，DirectSpace 工程人員正在努力搶救 &#8230; 不管發生什麼問題，掛點的機率也太高了吧 &#8230; 暫時也沒有經費切換到穩定一點的主機了 &#8230; DirectSpace 努力一點啊！</p>



<p>因為<strong><a rel="noreferrer noopener nofollow external" href="http://wazai.net/2217/%e8%ae%93%e4%ba%ba%e5%8f%88%e6%84%9b%e5%8f%88%e6%81%a8%e7%9a%84directspace" target="_blank" data-wpel-link="external" class="wpel-icon-right">讓人又愛又恨的DirectSpace<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>提到的 OOXX 的原因，使得最近重灌 Linux 的次數已經超過小蛙研究所畢業前灌 Linux 的次數了(實際上也算不出到底有幾次，有時候設定錯了，又懶得找回復的方法，就 &#8230; reinstall &#8230; 好孩子不要學)！記得小蛙友一個朋友講過一句話，「如果每次遇到問題就重灌，就永遠學不會 Linux」，難怪小蛙只要碰到 Linux，就要花上好多時間，還不一定可以解決 &#8230; 以下就用小蛙本身重灌時的設定順序來記錄。 </p>



<h2 class="para wp-block-heading">安裝並設定 fail2ban </h2>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">sudo apt-get update
sudo apt-get install fail2ban

先備份一份原始設定，避免改壞
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

編輯設定
vim /etc/fail2ban/jail.local

說明
bantime = 改成自己要的秒數，如果被 ban 要多久才能
findtime = 改成自己要的秒數，如果超過 maxretry 之後要多久才能
maxretry = 3 改成自己可以允許被 try 幾次
destemail = 改成自己要收到信的 email

重新啟動
service fail2ban stop
service fail2ban start</pre>



<h2 class="para wp-block-heading">VPS顯示及輸入中文 </h2>



<p>小蛙的VPS安裝完之後所有的設定都是偏向英語系國家，需做以下設定來讓從遠端透過Pietty登入的小蛙可以呈現及輸入正體中文字，這部分小蛙試了很多奇奇怪怪的方法，但下面的方法一次就搞定！ </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">######## 顯示中文問題
// 編輯自己家目錄下的 bash 環境
vim .bashrc

// 在最下面加入這些設定
export LANGUAGE="zh_TW.UTF-8"
export LANG="zh_TW.UTF-8"
export LC_ALL="zh_TW.UTF-8"

// 使用 source 讓設定檔生效時，發生以下錯誤
source .bashrc
-bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)

// 透過 locale-gen 產生 zh_TW.UTF-8 的語系
sudo locale-gen zh_TW.UTF-8
sudo update-locale LANG=zh_TW.UTF-8
// 完成後重新登入即可</pre>



<p>中文環境顯示設定參考資料 &lt;<strong><a href="http://changyy.pixnet.net/blog/post/28633165--bash%3A-warning%3A-setlocale%3A-lc_ctype%3A-cannot-change-locale-@-" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">-bash: warning: setlocale: LC_CTYPE: cannot change locale @ Ubuntu 10.04 @ 第二十四個夏天後<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>&gt;</p>



<h2 class="para wp-block-heading">安裝 bash 自動補齊工具</h2>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">apt-get install bash-completion
source /etc/profile</pre>



<h2 class="para wp-block-heading">移除 apache2</h2>



<p>中文環境有了讓人感覺比較安心，至少不用再看到奇奇怪怪的符號及亂碼，接下來由於小蛙想降低記憶體使用量，因此把肥大的apache2刪除，改安裝lighttpd。 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">####### 移除 apache2
查看套件
dpkg -l | grep apache2
刪除所有 apache2 開頭的套件
apt-get remove apache2*

刪除所有相依套件
apt-get autoremove 或 apt-get remove --auto-remove

刪除所有相關設定檔
apt-get remove --purge apache2
apt-get autoremove --purge</pre>



<p>參考資料 &lt;<strong><a rel="noreferrer noopener nofollow external" href="http://fcamel-life.blogspot.com/2011/06/ubuntu-apache2.html" target="_blank" data-wpel-link="external" class="wpel-icon-right">Ubuntu 移除 apache2 的方法 @ fcamel 技術隨手記<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>&gt;，內容提到使用aptitude，但小蛙沒有安裝該套件，就用apt-get remove來移除(應該是沒問題才對，如果有錯請留言跟小蛙說一聲，感恩！) </p>



<p>2018-06-07 補充&nbsp;<a rel="noreferrer noopener nofollow external" href="http://blog.lyhdev.com/2013/01/ubuntu-linux-apt-get.html" target="_blank" data-wpel-link="external" class="wpel-icon-right">[筆記] Ubuntu Linux 使用 apt-get 指令移除軟體並清理遺留的垃圾 @ 玩物尚誌<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 中提到。</p>



<h2 class="para wp-block-heading">安裝lighttpd, php5, mysql, phpmyadmin</h2>



<p>繼續安裝 lighttpd, php5, mysql, phpmyadmin &#8230; 等網頁及資料庫相關套件，這裡應該沒什麼問題才對，使用的資料庫別及密碼別弄錯就好，還有「Configure database for phpmyadmin with dbconfig-common?」要回答「Yes」。 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">####### 安裝 mysql, php5, lighttpd, phpmyadmin
apt-get install lighttpd php5-cgi php5-mysql mysql-server phpmyadmin
輸入 mysql root password
再次輸入 mysql root password
選擇使用的 http server : lighttpd
Configure database for phpmyadmin with dbconfig-common? Yes
database administrator's password : (輸入剛剛的 root 密碼)
phpadmin password : phpmyadmin 的密碼
re type phpmyadmin password :</pre>



<h2 class="para wp-block-heading">安裝Dropbox</h2>



<p>2013-06-24 更新，今天在新的 VPS 安裝 Dropbox 時發現以下方法已經無法安裝，但又發現 apt-get install dropbox 可以直接安裝！順便補充，如果不小心連結錯 dropbox 帳號的解決方法(<a rel="noreferrer noopener nofollow external" href="http://ubuntuforums.org/showthread.php?t=2111361" target="_blank" data-wpel-link="external" class="wpel-icon-right">參考資料<span class="wpel-icon wpel-image wpel-icon-6"></span></a>)： </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">dropbox stop
rm -rf ~/.dropbox*
dropbox start -i</pre>



<p>參考資料&lt;<strong><a rel="noreferrer noopener nofollow external" href="http://www.liberiangeek.net/2012/03/add-dropbox-repository-in-ubuntu-11-10-oneiric-ocelot/" target="_blank" data-wpel-link="external" class="wpel-icon-right">Add Dropbox Repository in Ubuntu 11.10 (Oneiric Ocelot) @ &nbsp;Liberian Geek.<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>&gt;。 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E
vim /etc/apt/sources.list.d/dropbox.list
新增 deb http://linux.dropbox.com/ubuntu/ oneiric main
apt-get update &amp;&amp; sudo apt-get install nautilus-dropbox</pre>



<p>安裝完成啟動時候出現警告訊息，會要求以 <strong>dropbox start -i</strong> 下載什麼key之類的，選擇y下載完成後再次 <strong>dropbox start</strong> 啟動，跳出的連結視窗就完成囉！<br>以下方法小蛙今天試了一次不知為何失效了，找不到資源檔，因此新增了上面的安裝方式。 </p>



<p>(2012-09-14 更新) 如果已經新增了，會不斷出現錯誤訊息 &#8230; &nbsp;可以在&nbsp;<strong>/etc/apt/sources.list.d</strong> 找到剛剛新增的，把不要的刪除即可。<br>對小蛙來說最重要的東西Dropbox，如果沒有這東西，之前的設定檔通通消失，全部要重新設定，簡直是噩夢！參考資料 &lt;<strong><a rel="noreferrer noopener nofollow external" href="http://www.arthurtoday.com/2010/09/ubuntu-add-apt-repository.html" target="_blank" data-wpel-link="external" class="wpel-icon-right">Ubuntu 為什麼找不到 add-apt-repository 的指令 ? @ 阿舍的隨手記記、隨手寫寫&#8230;<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>&gt;、&lt;<strong><a rel="noreferrer noopener nofollow external" href="http://raphaelhertzog.com/2011/06/06/official-debian-ubuntu-packages-for-nautilus-dropbox/" target="_blank" data-wpel-link="external" class="wpel-icon-right">Official Debian/Ubuntu packages for Dropbox<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>&gt;，這邊要額外安裝<strong>python-software-properties</strong>。 </p>



<h2 class="para wp-block-heading">安裝Git</h2>



<p>小蛙的VPS兼職當Git Server </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">####### 安裝 Git
apt-get install git-core</pre>



<h2 class="para wp-block-heading">安裝JDK, JRE</h2>



<p>接著安裝JDK、JRE，參考資料 &lt;<strong><a rel="noreferrer noopener nofollow external" href="http://weiwei.pixnet.net/blog/post/29999353-ubuntu-11.10-%E6%89%8B%E5%8B%95%E5%AE%89%E8%A3%9D-sun-java-6-jdk" target="_blank" data-wpel-link="external" class="wpel-icon-right">Ubuntu 11.10 手動安裝 Sun Java 6 JDK @ 維維 練肖喂～～<span class="wpel-icon wpel-image wpel-icon-6"></span></a></strong>&gt;，感覺裝了一大堆東西進去，在空間不吃緊的情況下，暫且先這樣吧！ </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">####### 安裝 JDK
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts</pre>



<h2 class="para wp-block-heading">設定系統時間</h2>



<p>最後設定系統時間，讓 crontab 以及 php5 能塞入正常時間的設定。 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">####### 重新設定時區
dpkg-reconfigure tzdata
vim /etc/php5/cgi/php.ini
date.timezone=Asia/Taipei</pre>



<h2 class="para wp-block-heading">解壓縮bz2</h2>



<p>接著就是等 dropbox 把之前備份的檔案抓回來，例如：lighttpd, php5, mysql, crontab, mysqldump, /var/www &#8230; 等備份，解壓縮之前備份的 backup.tar.bz2 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">tar -jxv -f 壓縮檔名稱 -C 解壓縮到
tar -jxv -f tt.tar.bz2 -C /root</pre>



<h2 class="para wp-block-heading">還原 mysqldump 備份資料</h2>



<p>還原mysqldump的資料 (附上備份方式 &#8211;&nbsp;<a rel="noreferrer noopener nofollow external" href="http://dba.tw/index.php?topic=137.0" target="_blank" data-wpel-link="external" class="wpel-icon-right">使用Mysqldump備份與如何還原資料庫 @ Database Admin Fourm<span class="wpel-icon wpel-image wpel-icon-6"></span></a>) </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">mysql -u root -p &lt; backup.sql</pre>



<h2 class="para wp-block-heading">還原 crontab 備份資料</h2>



<p>還原crontab內容 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">crontab backup_file</pre>



<h2 class="para wp-block-heading">安裝curl,&nbsp;sysv-rc-conf工具</h2>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">apt-get install curl
apt-get install sysv-rc-conf</pre>



<p>

到這邊重新安裝VPS大功告成！接下來就測試一下各功能有沒有問題囉！

</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2223/vps%e5%ae%89%e8%a3%9d%e8%a8%98%e9%8c%84/" data-wpel-link="internal">VPS安裝記錄</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/2223/vps%e5%ae%89%e8%a3%9d%e8%a8%98%e9%8c%84/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
