2018年1月9日 星期二

samba4

http://technote.aven-network.com/600/samba-4-%E5%95%9F%E7%94%A8%E5%8C%BF%E5%90%8D%E5%AD%98%E5%8F%96
https://www.phpini.com/linux/centos-7-install-samba
http://playubuntu.blogspot.tw/2013/04/samba40share.html

[global]
security = user
map to guest = Bad User
guest ok = Yes
guest account = XXX


# yum install samba samba-client samba-common -y
# mv /etc/samba/smb.conf /etc/samba/smb.conf.bak


設定 /etc/samba/smb.conf
[global]
        workgroup = IntraGroup
        server string = Samba Server %v
        netbios name = pubshare
        security = user
        map to guest = bad user
        dns proxy = no
[World_Share]
        path = /MDDATA/public/intra_share
        browsable =yes
        writable = yes
        guest ok = yes
        read only = no
        create mask = 0777
        directory mask = 0777

設定目錄權限

root # mkdir -p /MDDATA/public/intra_share
root # chown nobody.nobody /MDDATA/public/intra_share
root # chmod 700 /MDDATA/public/intra_share

啟用相關服務
3
4
root # systemctl enable smb.service
root # systemctl enable nmb.service
root # systemctl start smb.service
root # systemctl start nmb.service

----------------------------------
[global]
workgroup = workgroup
security = user
        netbios name = ntp
passdb backend = tdbsam
map to guest = bad user
dns proxy = no
guest account = guest

[share]
path = /share
browsable = yes
writable = yes
guest ok = yes
readonly = no
create mask = 0777
directory mask = 0777

---------------------------------
setenforce off

https://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/

# setsebool -P samba_export_all_ro=1 samba_export_all_rw=1
# getsebool –a | grep samba_export
# semanage fcontext –at samba_share_t "/finance(/.*)?"
# restorecon /finance
http://n.sfs.tw/content/index/11039
yum install semanage
No package semanage available.
Error: Nothing to do
OK,顯然找不到,這時使用yum 的option "provides"
# yum provides semanage
# yum install policycoreutils-python

---------------------------------
# firewall-cmd --add-service=samba --permanent
# firewall-cmd --reload









ANT and Tomcat

http://www.avajava.com/tutorials/lessons/how-do-i-deploy-to-tomcat-using-ant.html

https://www.safaribooksonline.com/library/view/java-servlet/0596005725/ch04s08.html

https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html#Executing_Manager_Commands_With_Ant

2018年1月8日 星期一

ubuntu 改時區



Ubuntu 要改變 Timezone 時區設定,可以用以下方法:
dpkg-reconfigure
用 root 身份用 dpkg-reconfigure 設定 Ubuntu 的 Timezone, 好處是有一個選單可以選擇地區,不用記著時區的字串:
# dpkg-reconfigure tzdata
出現 “Configuring tzdata” 後,先選擇地區,亞洲地區選擇 “Asia”, 然後再選擇所在城市,按 “OK” 後便完成,同時系統會印出新的 Timezone 時區設定。
timedatectl
另一個方法是用 timedatectl,使用前先用以下指令取得 Timezone 列表:

# timedatectl list-timezones
但 Timezone 列表十分長, 用 grep 過濾會較方便, 以下只會印出亞洲區的時區:
# timedatectl list-timezones | grep Asia
找到要設定的時區後, 便可以設定:
香港時區:
# timedatectl set-timezone Asia/Hong_Kong
台北時區:
# timedatectl set-timezone Asia/Taipei
設定好後, 可以用 timedatectl 指令檢查時區是否設定正確:
# timedatectl

ntp server , centos7

https://www.phpini.com/linux/rhel-centos-7-setup-ntp-sync-time

https://www.server-world.info/en/note?os=CentOS_7&p=ntp

root@dlp ~]# 
yum -y install ntp
[root@dlp ~]# 
vi /etc/ntp.conf
# line 18: add the network range you allow to receive requests

restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap
# change servers for synchronization

#
server 0.centos.pool.ntp.org iburst #這邊改成自己的上游
#
server 1.centos.pool.ntp.org iburst
#
server 2.centos.pool.ntp.org iburst
#
server 3.centos.pool.ntp.org iburst
server ntp1.jst.mfeed.ad.jp iburst
server ntp2.jst.mfeed.ad.jp iburst
server ntp3.jst.mfeed.ad.jp iburst
[root@dlp ~]# 
systemctl start ntpd 

[root@dlp ~]# 
systemctl enable ntpd 


[root@dlp ~]# 
firewall-cmd --add-service=ntp --permanent 

success
[root@dlp ~]# 
firewall-cmd --reload 

success

Verify it works normally like follows.
[root@dlp ~]# 
ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ntp1.jst.mfeed. 172.29.1.100     2 u   29   64    1   18.826   -0.126   0.000
+ntp2.jst.mfeed. 172.29.2.50      2 u   28   64    1   21.592    0.018   0.000
*ntp3.jst.mfeed. 133.243.236.18   2 u   28   64    1   22.666   -1.033   0.000

可以用 ntpstat 看同步了沒  不然會有 尚未時間同步之伺服器不被信任!!
網路斷掉要 retry 幾次才會上同步




2018年1月5日 星期五

Centos7 關閉 udev



-------------------------------------

https://www.phpini.com/linux/centos-7-network-interface-name

CentOS 7 修改網卡名稱 Eno* 成 Eth0

在 RHEL 及 CentOS 7 開始, 網卡的預設名稱由以往的 Ethx 改成 Enox, 以下文章會介紹將 CentOS 7 網卡名稱修改, 用回 Eth0 的方法。
首先開啟檔案 “/etc/sysconfig/grub” 修改設定:
# vi /etc/sysconfig/grub
內容大概是這樣:
裡面其中一行是 GRUB_CMDLINE_LINUX, 在這行結尾的雙引號前加上這句:
net.ifnames=0 biosdevname=0
要留意, 加上以上一行資料前, 要先加上一個空格, 整行修改後是這樣:

然後用 grub2-mkconfig 指令重新建立 GRUB 的設定檔:
# grub2-mkconfig -o /boot/grub2/grub.cfg
接著要將 Eno 網卡的設定檔用 mv 改名為 eth0:
# mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0
編輯 /etc/sysconfig/network-scripts/ifcfg-eth0 檔案, 找到 “Name” 的一行, 改成 eth0, 全句是這樣:
NAME=eth0
​最後重新啟動系統便會生效, 要確認修改成功, 可以用 ifconfig 指令確認。
--------------------------------