<!DOCTYPE html>
	<html lang="vi" xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
	<head>
<title>Hướng dẫn cài đặt Ubuntu server</title>
<meta name="description" content="Hướng dẫn cài đặt Ubuntu server - Savefile - Tin Tức - http&#x3A;&#x002F;&#x002F;thienhashop.com&#x002F;news&#x002F;savefile&#x002F;huong-dan-phan-mem&#x002F;huong-dan-cai-dat-ubuntu-server-151.html">
<meta name="author" content="PHAN MEM THIEN HA">
<meta name="copyright" content="PHAN MEM THIEN HA [phamhuy842005@gmail.com]">
<meta name="robots" content="index, archive, follow, noodp">
<meta name="googlebot" content="index,archive,follow,noodp">
<meta name="msnbot" content="all,index,follow">
<meta name="generator" content="NukeViet v4.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="og:title" content="Hướng dẫn cài đặt Ubuntu server">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Tin Tức - http&#x3A;&#x002F;&#x002F;thienhashop.com&#x002F;news&#x002F;savefile&#x002F;huong-dan-phan-mem&#x002F;huong-dan-cai-dat-ubuntu-server-151.html">
<meta property="og:site_name" content="PHAN MEM THIEN HA">
<meta property="og:url" content="http://phanmemthienha.com/news/huong-dan-phan-mem/huong-dan-cai-dat-ubuntu-server-151.html">
<link rel="shortcut icon" href="http://thienhashop.com/uploads/logo-shop-thien-ha-5.png">
<link rel="canonical" href="http://phanmemthienha.com/news/huong-dan-phan-mem/huong-dan-cai-dat-ubuntu-server-151.html">
<link rel="alternate" href="http://thienhashop.com/news/rss/" title="Tin Tức" type="application/rss+xml">
<link rel="alternate" href="http://thienhashop.com/news/rss/huong-dan-phan-mem/" title="Tin Tức - Hướng dẫn phần mềm" type="application/rss+xml">
<link rel="alternate" href="http://thienhashop.com/news/rss/huong-dan-noi-bo/" title="Tin Tức - Hướng dẫn nội bộ" type="application/rss+xml">
<link rel="alternate" href="http://thienhashop.com/news/rss/Doi-tac/" title="Tin Tức - Đối tác" type="application/rss+xml">
<link rel="alternate" href="http://thienhashop.com/news/rss/Tuyen-dung/" title="Tin Tức - Tuyển dụng" type="application/rss+xml">
<link rel="preload" as="script" href="http://thienhashop.com/assets/js/jquery/jquery.min.js">
<link rel="preload" as="script" href="http://thienhashop.com/assets/js/language/vi.js">
<link rel="preload" as="script" href="http://thienhashop.com/assets/js/global.js">
<link rel="preload" as="script" href="http://thienhashop.com/themes/default/js/news.js">
<link rel="preload" as="script" href="http://thienhashop.com/themes/popovleather/js/main.js">
<link rel="preload" as="script" href="http://thienhashop.com/themes/popovleather/js/bootstrap.min.js">
<link rel="StyleSheet" href="http://thienhashop.com/assets/css/font-awesome.min.css">
<link rel="StyleSheet" href="http://thienhashop.com/themes/popovleather/css/bootstrap.min.css">
<link rel="StyleSheet" href="http://thienhashop.com/themes/popovleather/css/style.css">
<link rel="StyleSheet" href="http://thienhashop.com/themes/popovleather/css/style.responsive.css">
<link rel="StyleSheet" href="http://thienhashop.com/themes/default/css/news.css">
<link rel="StyleSheet" href="http://thienhashop.com/assets/css/popovleather.vi.0.css?t=87">
<style>
	body{background: #fff;}
</style>
	</head>
	<body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">PHAN MEM THIEN HA</h2>
		<p class="pull-right"><a title="PHAN MEM THIEN HA" href="http://thienhashop.com/">http://thienhashop.com</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>Hướng dẫn cài đặt Ubuntu server</h1>
		<ul class="list-inline">
			<li>Thứ sáu - 18/10/2019 16:57</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
			Lưu lại các phần hướng dẫn cài ubuntu server
		</div>
				<div class="imghome">
			<img alt="Hướng dẫn cài đặt Ubuntu server" src="http://thienhashop.com/uploads/news/2019_10/cau-hinh-tao-tai-khoan-nguoi-dung-moi-cho-mysql-tren-phpmyadmin-1.png" width="460" class="img-thumbnail" />
		</div>
		<div class="clear"></div>
		<div id="bodytext" class="clearfix">
			1. Tạo USB Cài Ubuntu với Rufus<br  />
+ Bước 1: Đầu tiền tải về Rufus tại trang chủ https://rufus.ie, hoặc tải theo link tự phòng (bản 3.5 như bài hướng dẫn)<br  />
+ Bước 2: Bạn nên sử dụng bản Rufus Portable để đỡ phải cài đặt khi sử dụng &amp; bạn hãy chuẩn bị một chiếc USB có dung lượng tối thiểu là 4GB nhé.<br  />
Thực hiện: Bạn mở phần mềm lên và cắm chiếc USB vào máy tính. Bạn thiết lập các tùy chọn như trong hình bên dưới =&gt; rồi kích vào Start để bắt đầu tạo USB cài Ubuntu.<br  />
<br  />
2. Cài Giao Diện Đồ Họa Trên Ubuntu Server<br  />
sudo apt-get update<br  />
sudo apt-get install lxde<br  />
3. Cài đặt VNC Server<br  />
Đăng nhập ssh để cài đặt VNC (Cài 1 lần dùng mãi) - Dùng Terminal của HĐH Linux hoặc dùng Windows thì có thể dùng Putty hoặc Bitvise SSH Client<br  />
&nbsp;sudo apt-get update<br  />
&nbsp;sudo apt-get install tightvncserver<br  />
&nbsp;vncserver :1 -geometry 1024x600 -depth 16 -pixelformat rgb565<br  />
&nbsp;vncserver :1<br  />
&nbsp; để chạy thông số mặc định thôi.<br  />
Chi tiet co hon <a href="https://hocvps.com/huong-dan-cai-dat-vnc-server-tren-ubuntu-13-04/" target="_blank">tai day</a><br  />
<br  />
4. Cài đặt xampp for ubuntu<br  />
wget https://www.apachefriends.org/xampp-files/7.3.10/xampp-linux-x64-7.3.10-0-installer.run<br  />
chmod 755 xampp-linux-x64-7.3.10-0-installer.run<br  />
sudo ./xampp-linux-x64-7.3.10-0-installer.run<br  />
<br  />
sau khi cài xong thì có thể khởi động xampp bằng control xampp hoặc lệnh<br  />
$ sudo /opt/lampp/lampp start<br  />
<br  />
Việc sử dụng phpmyadmin qua mạng Lan thì cần cấu hình lại file &quot;httpd-xampp.conf&quot;.&nbsp;<br  />
<br  />
If you see below error message, when try into phpyAdmin:<br  />
New XAMPP security concept:<br  />
Access to the requested directory is only available from the local network.<br  />
This setting can be configured in the file &quot;httpd-xampp.conf&quot;.<br  />
<br  />
You can do next (for XAMPP, deployed on the UNIX-system): You can try change configuration for &lt;Directory &quot;/opt/lampp/phpmyadmin&quot;&gt;<br  />
<br  />
# vi /opt/lampp/etc/extra/httpd-xampp.conf<br  />
<br  />
and change security settings to<br  />
<br  />
&lt;Directory &quot;/opt/lampp/phpmyadmin&quot;&gt;<br  />
&nbsp;&nbsp;&nbsp; AllowOverride AuthConfig Limit<br  />
&nbsp;&nbsp;&nbsp; Order allow,deny<br  />
&nbsp;&nbsp;&nbsp; Allow from all<br  />
&nbsp;&nbsp;&nbsp; Require all granted<br  />
&nbsp;&nbsp;&nbsp; ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var<br  />
&lt;/Directory&gt;<br  />
<br  />
First - comment pl module, second - change config for node Directory. After it, you should restart httpd daemon<br  />
<br  />
# /opt/lampp/xampp restart<br  />
<br  />
Now you can access http://&#91;server_ip&#93;/phpmyadmin/<br  />
<br  />
5. Thêm tài khoản mysql cho hệ thống có thể làm theo hình ảnh dưới<br  />
<img alt="cau hinh tao tai khoan nguoi dung moi cho mysql tren phpmyadmin" height="959" src="http://thienhashop.com/uploads/news/2019_10/cau-hinh-tao-tai-khoan-nguoi-dung-moi-cho-mysql-tren-phpmyadmin-1.png" width="700" /><br  />
<br  />
Cài website lên hosting thì cần phải chmod thư mục.<br  />
<br  />
sudo chmod -R 777 /opt/lampp/htdocs/app1<br  />
<br  />
<br  />
Step 4: Config XAMPP run to VirtualHost<br  />
<br  />
a. Edit file: /opt/lampp/etc/httpd.conf (để chạy được virtual hosts hãy xóa dấu # ở đầu dòng )<br  />
<br  />
#Include etc/extra/httpd-vhosts.conf<br  />
<br  />
to<br  />
<br  />
Include etc/extra/httpd-vhosts.conf<br  />
<br  />
b. Edit file: etc/extra/httpd-vhosts.conf<br  />
<br  />
To:<br  />
<br  />
&lt;VirtualHost *:80&gt;<br  />
ServerAdmin <a data-original-title="" href="mailto:saurom1205@gmail.com" title="">saurom1205@gmail.com</a><br  />
DocumentRoot &quot;/opt/lampp/htdocs/minhduc&quot;<br  />
ServerName minhduc.com<br  />
ServerAlias <a class="postlink" data-original-title="" href="http://www.minhduc.com" title="">http://www.minhduc.com</a><br  />
ErrorLog &quot;/opt/lampp/htdocs/minhduc/logs/error_log.log&quot;<br  />
CustomLog &quot;/opt/lampp/htdocs/minhduc/logs/access.log&quot; common<br  />
&lt;/VirtualHost&gt;<br  />
c. sua lai file /etc/hosts<br  />
<br  />
127.0.0.1 localhost mypc<br  />
127.0.0.1 minhduc.com<br  />
<br  />
<strong>Tăng giới hạn upload file trên Xampp for linux</strong><br  />
sudo chmod -R 777 /opt/lampp/etc/php.ini<br  />
rùi sửa file
<pre style="color=:red;">
post_max_size = 200M 
upload_max_filesize = 200M 
max_execution_time = 3000 
max_input_time = 3000 
memory_limit = 200M 
</pre>

<p>Do mặc định PHP cho time-out là 30 giây. Nếu bạn cho phép người dùng upload 10M, thì bạn phải chỉnh file cấu hình cho thời gian time-out tăng lên.</p>

<p>Sau khi cấu hình xong nhớ khởi động lại server để hệ thống cập nhật lại.</p>
<br  />
<br  />
CHÚ Ý:<br  />
để sửa được file thì cần chmod 777 cho file đó<br  />
sudo chmod -R 777 /opt/lampp/etc/httpd.conf<br  />
sau khi sửa xong thì<br  />
sudo chmod -R 755 /opt/lampp/etc/httpd.conf<br  />
và<br  />
sudo chmod -R 777 /opt/lampp/etc/extra/httpd-vhosts.conf<br  />
sau khi sửa xong thì<br  />
sudo chmod -R 755 /opt/lampp/etc/extra/httpd-vhosts.conf<br  />
và<br  />
&nbsp;sudo chmod 777 /etc/hosts<br  />
sau khi sửa xong thì<br  />
&nbsp;sudo chmod 755 /etc/hosts<br  />
<br  />
Cùng 1 tên miền mà chạy nhiều ứng dụng khác nhau.<br  />
Theo cách trên, ứng với mỗi project, chúng ta sẽ có một đường dẫn tương ứng:<br  />
<br  />
&nbsp;&nbsp;&nbsp; http://localhost/myproject/hello-world.php<br  />
&nbsp;&nbsp;&nbsp; http://localhost/project_a/hello-world.php<br  />
&nbsp;&nbsp;&nbsp; http://localhost/project_b/hello-world.php<br  />
<br  />
Cách sử dụng trên sẽ trở nên dài vì có thêm tên project, hoặc sẽ trở nên bất tiện nếu chúng ta sử dụng đường dẫn root có dạng /myproject/include/file.php.<br  />
<br  />
Để giải quyết vấn đề trên, chúng ta sẽ cấu hình XAMPP sao cho có thể chạy được nhiều domain ngắn gọn hơn và có thể dùng root path tiện lợi hơn, khi này thay vì viết như trên, chúng ta có thể sử dụng đường dẫn như sau:<br  />
<br  />
&nbsp;&nbsp;&nbsp; http://localhost:81/hello-world.php<br  />
&nbsp;&nbsp;&nbsp; http://localhost:82/hello-world.php<br  />
&nbsp;&nbsp;&nbsp; http://localhost:83/hello-world.php<br  />
<br  />
Chúng ta cũng có thể sử dụng cách này để cấu hình chạy nhiều domain trong cùng một server.<br  />
Thêm port cho XAMPP: httpd.conf<br  />
&nbsp;&nbsp;&nbsp; Khi file httpd.conf đã được mở, tìm tới dòng #Listen 12.34.56.78:80, bạn sẽ thấy đoạn code bên trong có dạng như sau:<br  />
<br  />
#Listen 12.34.56.78:80<br  />
Listen 80<br  />
<br  />
&nbsp;&nbsp;&nbsp; Port 80 là port mặc định chạy http://localhost/ của XAMPP.<br  />
&nbsp;&nbsp;&nbsp; Từ vị trí này ta thêm nhiều port khác nhau, save lại sau mỗi lần thêm port:<br  />
<br  />
#Listen 12.34.56.78:80<br  />
Listen 80<br  />
Listen 81<br  />
Listen 82<br  />
Listen 83<br  />
<br  />
<br  />
<br  />
##&lt;VirtualHost *:80&gt;<br  />
&nbsp;&nbsp;&nbsp; ##ServerAdmin webmaster@dummy-host.example.com<br  />
&nbsp;&nbsp;&nbsp; ##DocumentRoot &quot;C:/xampp/htdocs/dummy-host.example.com&quot;<br  />
&nbsp;&nbsp;&nbsp; ##ServerName dummy-host.example.com<br  />
&nbsp;&nbsp;&nbsp; ##ServerAlias www.dummy-host.example.com<br  />
&nbsp;&nbsp;&nbsp; ##ErrorLog &quot;logs/dummy-host.example.com-error.log&quot;<br  />
&nbsp;&nbsp;&nbsp; ##CustomLog &quot;logs/dummy-host.example.com-access.log&quot; common<br  />
##&lt;/VirtualHost&gt;<br  />
<br  />
&nbsp;&nbsp;&nbsp; Bên dưới đoạn code mẫu này ta thêm đoạn code cấu hình sau:<br  />
<br  />
&lt;VirtualHost *:82&gt;<br  />
&nbsp;&nbsp;&nbsp; DocumentRoot &quot;C:/xampp/htdocs/myproject&quot;<br  />
&nbsp;&nbsp;&nbsp; ServerName myproject.hwc<br  />
&nbsp;&nbsp;&nbsp; ServerAlias www.myproject.hwc<br  />
&nbsp;&nbsp;&nbsp; ErrorLog &quot;C:/xampp/apache/logs/myproject.hwc-error.log&quot;<br  />
&nbsp;&nbsp;&nbsp; CustomLog &quot;C:/xampp/apache/logs/myproject.hwc-access.log&quot;<br  />
&nbsp;&nbsp;&nbsp; &lt;Directory &quot;C:/xampp/htdocs/myproject&quot;&gt;<br  />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order Allow,Deny<br  />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Allow from all<br  />
&nbsp;&nbsp;&nbsp; &lt;/Directory&gt;<br  />
&lt;/VirtualHost&gt;<br  />
<br  />
&nbsp;&nbsp;&nbsp; &lt;VirtualHost *:82&gt; : Đây là một trong những port đã được thêm vào httpd.conf, nếu cấu hình chạy domain thì chúng ta có thể dùng port 80.<br  />
&nbsp;&nbsp;&nbsp; DocumentRoot Thư mục chứa project (khai báo bắt buộc).<br  />
&nbsp;&nbsp;&nbsp; ServerName Tên server, dùng tên domain và port nếu có (khai báo bắt buộc).<br  />
&nbsp;&nbsp;&nbsp; ServerAlias Tên thay thế cho tên server (khai báo tùy chọn).<br  />
&nbsp;&nbsp;&nbsp; ErrorLog Đường dẫn tới file log error, sẽ xem lỗi từ đây (khai báo tùy chọn).<br  />
&nbsp;&nbsp;&nbsp; CustomLog Đường dẫn tới file log Uri khi người dùng request (khai báo tùy chọn).<br  />
&nbsp;&nbsp;&nbsp; Directory Bên trong tag này dùng để cấp quyền cho thư mục.<br  />
<br  />
<br  />
<br  />
d. Restart xampp: /opt/lampp/lampp restart<br  />
<br  />
Step5: Auto start , stop XAMPP FOR LINUX PUPPY<br  />
<br  />
Edit file: /etc/rc.d/rc.local<br  />
<br  />
--&gt; Add line:<br  />
<br  />
code:<br  />
if &#91; -x /opt/lampp/lampp &#93;; then<br  />
/opt/lampp/lampp start<br  />
fi<br  />
<br  />
Edit file: /etc/rc.d/rc.local_shutdown<br  />
---&gt; Add line:<br  />
<br  />
if &#91; -x /opt/lampp/lampp &#93;; then<br  />
/opt/lampp/lampp stop<br  />
fi<br  />
<br  />
Step 6: Uninstall<br  />
<br  />
To uninstall XAMPP just type in this command:<br  />
<br  />
rm -rf /opt/lampp<br  />
<br  />
The end.<br  />
<br  />
Auto Start XAMPP at Startup in Ubuntu Linux<br  />
( <a href="https://www.computernetworkingnotes.com/linux-tutorials/auto-start-xampp-at-startup-in-ubuntu-linux.html" target="_blank">Chi tiết</a> )<br  />
Tạo file /etc/systemd/system/xampp.service<br  />
sudo touch /etc/systemd/system/xampp.service
<p>In the opened file, add the following lines and save the file.</p>

<div class="code">
<pre>
&#91;Unit&#93;
Description=XAMPP

&#91;Service&#93;
ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop
Type=forking

&#91;Install&#93;
WantedBy=multi-user.target
</pre>
</div>
sudo systemctl enable xampp.service

<p>After reboot, open the terminal and run the following command.</p>

<div class="code">
<pre>
sudo systemctl status xampp.service
</pre>
</div>
sudo systemctl status xampp.service<br  />
<br  />
Tham khao them cach 2 <a href="https://vinasupport.com/bat-xampp-chay-tu-dong-khi-khoi-dong-ubuntu/" target="_blank">tai day</a><br  />
<br  />
<br  />
<br  />
<br  />
<br  />
<br  />
<br  />
<br  />
<br  />
<br  />
DDNS update for Doman myq-see.com
<h3 style="text-align:left;">Microsoft Windows Update Clients</h3>

<p>Our native DDNS update client for Windows.<br  />
<a href="http://myq-see.com/MintClient.zip">MintClient.zip</a></p>

<h3 style="text-align:left;">Linux/Unix Update Clients</h3>

<p>DDCLIENT v3.9.0<br  />
<a href="https://github.com/ddclient/ddclient" target="_new">ddclient on Gitbub</a><br  />
Internet Automated Dynamic DNS Client<br  />
<a href="https://github.com/troglobit/inadyn" target="_new">INADYN on Gitbub</a><br  />
DDCLIENT configuration file.<br  />
<a href="http://myq-see.com/ddclient.txt" target="_new">A sample DDCLIENT configuration file.</a></p>

<h3 style="text-align:left;">Android Update Clients</h3>

<p>Dynamic DNS Update for Android<br  />
<a href="https://play.google.com/store/apps/details?id=com.icecoldapps.dynamicdnsupdate&amp;hl=en" target="_new">Dynamic DNS Update</a></p>
<br  />
<br  />
<br  />
<br  />
&nbsp;
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="http://thienhashop.com/news/huong-dan-phan-mem/huong-dan-cai-dat-ubuntu-server-151.html" title="Hướng dẫn cài đặt Ubuntu server">http://thienhashop.com/news/huong-dan-phan-mem/huong-dan-cai-dat-ubuntu-server-151.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; PHAN MEM THIEN HA
		</div>
		<div id="contact">
			<a href="mailto:phamhuy842005@gmail.com">phamhuy842005@gmail.com</a>
		</div>
	</div>
</div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="http://thienhashop.com/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
<div id="run_cronjobs" style="visibility:hidden;display:none;"><img alt="" src="/index.php?second=cronjobs&amp;p=s6JL4vWd" width="1" height="1" /></div>
<script src="http://thienhashop.com/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="news",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=7,nv_my_abbr="ICT",nv_cookie_prefix="nv4c_y8Y7D",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=1,nv_is_recaptcha=1,nv_recaptcha_sitekey="6LeSarIUAAAAAHRq6xkHwO6J0YYQOdMxgqKTXoL_",nv_recaptcha_type="image",nv_recaptcha_elements=[];</script>
<script src="http://thienhashop.com/assets/js/language/vi.js"></script>
<script src="http://thienhashop.com/assets/js/global.js"></script>
<script src="http://thienhashop.com/themes/default/js/news.js"></script>
<script src="http://thienhashop.com/themes/popovleather/js/main.js"></script>
<script src="http://thienhashop.com/themes/popovleather/js/bootstrap.min.js"></script>
</body>
</html>