tag:blogger.com,1999:blog-15814774589999615832024-02-20T11:06:05.827-08:00呆Anonymoushttp://www.blogger.com/profile/13582130938359615857noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-1581477458999961583.post-50130222133550262642016-03-29T19:25:00.003-07:002016-03-29T19:25:26.006-07:00在 CentOS7上架設 Samba Server<h3 class="post-title entry-title" itemprop="name" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 22px; font-stretch: normal; font-weight: normal; margin: 0.75em 0px 0px; position: relative;">
在 CentOS7上架設 Samba Server<br /><span style="color: #cccccc; font-size: 13.2px; line-height: 1.4;"><br /></span></h3>
<h3 class="post-title entry-title" itemprop="name" style="background-color: white; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 22px; font-stretch: normal; font-weight: normal; margin: 0.75em 0px 0px; position: relative;">
<span style="font-size: 13.2px; line-height: 1.4;"><span style="color: red;">安裝 Samba Server 套件:</span></span><br /><span style="color: blue; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;">#yum -y install samba</span></h3>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">
<span style="color: blue; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><br /></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">設定欲分享目錄:</span></span><br /><span style="color: blue; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;">#mkdir /sharedpath</span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="background-color: white; color: blue; font-family: 'courier new';"><span style="font-size: 14.6667px; line-height: 17.6px;"><br /></span></span><span style="background-color: white; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">設定 SELinux 限定規則:</span></span><br /><span style="background-color: white; color: blue;"><span style="font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 11pt; line-height: 1.2em;">#semanage fcontext -a -t samba_share_t '/sharedpath(/.*)?'</span><br /><span style="font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 11pt; line-height: 1.2em;">#restorecon -RFvv /sharedpath</span></span><br /><span style="background-color: white; color: #cccccc; font-family: 'courier new';"><span style="line-height: 17.6px;"><span style="color: blue; font-family: arial, tahoma, helvetica, freesans, sans-serif;"><span style="font-size: 14.6667px;"><br /></span></span></span></span><span style="background-color: white; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">設定 Samba Server 設定檔:</span></span><br /><span style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"><span style="color: blue;">#vim /etc/samba/smb.conf</span></span><br /><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">[</span><span class="kwd" style="background-color: white; color: #000088; font-size: 11pt; line-height: 1.2em;">global</span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">]</span><br /><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">workgroup </span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">=</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"> WORKGROUP</span><br /><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">interfaces </span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">=</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"> lo eth0 </span><span style="background-color: black; color: white;"><span class="lit" style="font-size: 11pt; line-height: 1.2em;">192.168</span><span class="pun" style="font-size: 11pt; line-height: 1.2em;">.</span><span class="lit" style="font-size: 11pt; line-height: 1.2em;">1.1</span><span class="pun" style="font-size: 11pt; line-height: 1.2em;">/</span><span class="lit" style="font-size: 11pt; line-height: 1.2em;">24</span></span><br /><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">hosts allow </span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">=</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"> </span><span style="background-color: black;"><span style="color: white;"><span class="lit" style="font-size: 11pt; line-height: 1.2em;">127.</span><span class="pln" style="font-size: 11pt; line-height: 1.2em;"> </span><span class="lit" style="font-size: 11pt; line-height: 1.2em;">192.168</span><span class="pun" style="font-size: 11pt; line-height: 1.2em;">.</span><span class="lit" style="font-size: 11pt; line-height: 1.2em;">1.</span></span></span><br /><span class="pun" style="background-color: white; color: red; font-size: 11pt; line-height: 1.2em;"><br /></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span class="pun" style="background-color: white; color: red; font-size: 11pt; line-height: 1.2em;">置底</span><br /><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">[</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">myshare</span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">]</span><br /><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">path </span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">=</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"> </span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">/</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">sharedpath</span><br /><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">writable </span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">=</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"> </span><span class="kwd" style="background-color: white; color: #000088; font-size: 11pt; line-height: 1.2em;">no</span><br /><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;">valid users </span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">=</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"> fred</span><span class="pun" style="background-color: white; color: #666600; font-size: 11pt; line-height: 1.2em;">,</span><span class="pln" style="background-color: white; color: #333333; font-size: 11pt; line-height: 1.2em;"> </span><span class="lit" style="background-color: white; color: #006666; font-size: 11pt; line-height: 1.2em;">@management</span><br /><span style="background-color: white; color: #cccccc; font-family: 'courier new';"><span style="font-size: 14.6667px; line-height: 17.6px; white-space: pre;"><br /></span></span><span style="background-color: white; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">開啟 SELinux 存取規則:</span></span><br /><span style="background-color: white; color: blue;"><span style="font-size: 11pt; line-height: 1.2em;">#setsebool -P samba_enable_home_dirs=on</span><br /><span style="font-size: 11pt; line-height: 1.2em;">#restorecon -RFvv /sharedpath</span></span><br /><span style="background-color: white; color: #cccccc; font-family: 'courier new';"><span style="font-size: 14.6667px; line-height: 17.6px; white-space: pre;"><br /></span></span><span style="background-color: white; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">在 Samba Server 上,検查設定項目是否正確:</span></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="background-color: white; color: blue; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;">#testparm</span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="background-color: white; color: blue; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><br /></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="background-color: white; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">在 Samba Server 上,新增一般的使用者帳號與密碼:</span></span><br /><span style="background-color: white; color: #333333; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><span style="color: blue;">#useradd -s /sbin/nologin fred</span></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="background-color: white; color: #333333; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><span style="color: blue;"><br /></span></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="font-size: 13.2px; line-height: 1.4;"><span style="color: red;">在 Samba Server 上,安裝管理使用者的套件:</span></span><br /><span style="color: #333333; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><span style="color: blue;">#yum -y install samba-client</span></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="color: blue; font-family: 'courier new';"><span style="font-size: 14.6667px; line-height: 17.6px;"><br /></span></span><span style="font-size: 13.2px; line-height: 1.4;"><span style="color: red;">在 Samba Server 上,設定可存取 Samba Server的使用者帳號與密碼:</span></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><span style="color: blue;">#smbpasswd -a fred</span></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; position: relative; width: 684px;">
<span style="color: blue; font-family: 'courier new';"><span style="font-size: 14.6667px; line-height: 17.6px;"><br /></span></span><span style="font-size: 13.2px; line-height: 1.4;"><span style="color: red;">啟動 Samba Server:</span></span><br /><span style="color: blue;"><span style="font-size: 11pt; line-height: 1.2em;">#systemctl start smb nmb</span><br /><span style="font-size: 11pt; line-height: 1.2em;">#systemctl enable smb nmb</span></span><br /><span style="color: #cccccc; font-family: 'courier new';"><span style="font-size: 14.6667px; line-height: 17.6px; white-space: pre;"><br /></span></span><span style="font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">在 Samba Server 上,開啟防火牆設定:</span></span><br /><span style="color: blue;"><span style="font-size: 11pt; line-height: 1.2em;">#firewall-cmd --permanent --add-service=samba</span><br /><span style="font-size: 11pt; line-height: 1.2em;">#firewall-cmd --reload</span></span></div>
<div class="post-body entry-content" id="post-body-6317637907144394504" itemprop="description articleBody" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; position: relative; width: 684px;">
<span style="color: blue;"><span style="font-size: 14.6667px; line-height: 17.6px;"><br /></span></span><span style="font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px; line-height: 1.4;"><span style="color: red;">在 client 端,掛載 Samba Server 所分享目錄:</span></span><br /><span style="color: #333333; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><span style="color: blue;">#mkdir /mnt/myshare</span></span><br /><span style="color: #333333; font-family: 'courier new'; font-size: 11pt; line-height: 1.2em;"><span style="color: blue;">#mount -t cifs -o username=fred //server/myshare /mnt/myshare</span></span></div>
Anonymoushttp://www.blogger.com/profile/13582130938359615857noreply@blogger.com0tag:blogger.com,1999:blog-1581477458999961583.post-81479844059311274552016-03-21T19:52:00.000-07:002016-03-21T19:52:36.029-07:00在CentOS7/RHEL7上安裝MariaDB設定Web Server<b style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; line-height: 25.2px;">快速設定流程:</b><br />
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;"><span style="color: red;">安裝 MySQL/MariaDB 套件:</span></span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#yum -y install mariadb mariadb-server mariadb-bench</span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;"><span style="color: red;">啟動 MySQL Server :</span></span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#systemctl start mariadb.service</span></div>
<div>
<span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;"> </span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#systemctl enable mariadb.service</span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;"><span style="color: red;">查詢預設 root 密碼:</span></span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#systemctl status mariadb -l</span></div>
<div>
<span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;"> </span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#vim </span></div>
<div>
<b style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; line-height: 25.2px;">基本設定流程:</b></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;"><span style="color: #b45f06;">安裝 Web Server 套件:</span></span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#yum -y install httpd</span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;"><span style="color: #b45f06;">設定啟動 Web Server 服務:</span></span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#systemctl enable httpd.service</span></div>
<div>
<span style="background-color: white;"> <span style="font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#systemctl start httpd.service</span></span></div>
<div>
<span style="font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif;"><span style="background-color: white; color: #cccccc; font-size: 13.2px; line-height: 18.48px;"> </span></span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#systemctl status httpd.service</span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;"><span style="color: #b45f06;">設定開通防火牆:</span></span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#firewall-cmd --permanent --add-service=http</span></div>
<div>
<span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;"> </span><span style="background-color: white; font-family: "courier new"; font-size: 11pt; line-height: 1.2em;">#firewall-cmd --reload</span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;">Apache 相關設定檔案:</span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;">主要設定檔:<span style="color: blue;">/etc/httpd/conf/httpd.conf</span></span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;">設定檔目錄:<span style="color: blue;">/etc/httpd/conf.d/</span></span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;">網頁放置目錄:<span style="color: blue;">/var/www/html</span></span></div>
<div>
<span style="background-color: white; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13.2px; line-height: 18.48px;"><span style="color: blue;"><br /></span></span></div>
Anonymoushttp://www.blogger.com/profile/13582130938359615857noreply@blogger.com0