目前分類:系統管理 (432)

瀏覽方式: 標題列表 簡短摘要

# 檢查目前系統時區狀態
[root@test01 ~]# timedatectl
      Local time: Thu 2019-06-27 10:41:44 CST
  Universal time: Thu 2019-06-27 02:41:44 UTC
        RTC time: Thu 2019-06-27 02:41:43
       Time zone: Asia/Taipei (CST, +0800)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

# 若要變更時區,首先列出所有的時區
timedatectl list-timezones

# 指定系統時區
timedatectl set-timezone Asia/Taipei

# 安裝 ntpdate
yum -y install ntp

# 校正時間
ntpdate time.stdtime.gov.tw



 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

1. 登入管理介面,選擇dashboard 頁籤 -> 把要重設密碼的機器關機

2. 切換到 rescue 頁籤,拉到最下面,填入新密碼,並點擊 Reset Root Password

3. 回到 dashboard 頁籤 -> 開機

4. 重開機後即可用新密碼登入

undefined
Effective DevOps:使用AWS快速入門

作者: Nathaniel Felsen  
譯者: 錢亞宏
出版社:博碩  

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

開始寫入 log
在 shell 下以root 權限輸入 rndc querylog
# rndc querylog

接下來可以使用以下指令觀察目前的查詢log
# tail -f /var/log/messages

停止寫入 log,避免 log 檔案過大
# rndc querylog

undefined
DNS and BIND管理,第五版

作者: 蔣大偉  
出版社:歐萊禮

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

1. 進到 console 介面,選擇 5) Reboot System
重設 pfsense admin 預設密碼

2. 開機時選擇 single user mode

3. 登入 /bin/sh 後,依序輸入
umount -a 
mount -a

4. /etc/rc.initial/password
確定之後,admin 密碼會回復到預設的 pfsense
重設 pfsense admin 預設密碼

5. reboot
重開機後,記得登入 web 介面修改admin密碼
 

helloworld 發表在 痞客邦 留言(0) 人氣()

解決 NetApp AutoSupport message: (OUT OF INODES) ERROR
發生原因: 同一個volume 雖然空間夠,但檔案數量過多,inode 不足用盡,所以無法再寫入檔案

以下三種解決方式

1. 把檔案搬到其他volume 或是移除不必要的檔案

2. 新增 volume 的 maxfiles 數量
(1)登入netapp cli 介面
(2)輸入 df -i 或是 maxfiles "volume名稱"
可以看到目前volume 的使用狀況
(3)如何增加 maxfiles 
maxfiles "volume名稱" "inode數量"

example:
filer> maxfiles voltest 63753378

The new maximum number of files specified is more than twice as big as
it needs to be, based on current usage patterns.  This invocation of the
operation on the specified volume will allow disk space consumption for
files to grow up to the new limit depending on your workload. The maxfiles
setting cannot be lowered below the point of any such additional disk space
consumption and any additional disk space consumed can never be reclaimed.
Also, such consumption of additional disk space could result in less
available memory after an upgrade.


The new maximum number of files will be rounded to 63753378.

Are you sure you want to change the maximum number of files? y
finer>

3. 增加 volume 空間
undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

timedatectl 指令可以顯示目前設定
# timedatectl
      Local time: Thu 2019-05-02 06:45:47 UTC
  Universal time: Thu 2019-05-02 06:45:47 UTC
        RTC time: Thu 2019-05-02 06:45:48
       Time zone: Etc/UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

修改timezone
# cd /etc

# ls -lh | grep localtime
lrwxrwxrwx 1 root root     27 May 24  2018 localtime -> /usr/share/zoneinfo/Etc/UTC

# rm localtime && ln -s /usr/share/zoneinfo/Asia/Taipei localtime

# ls -lh | grep localtime
lrwxrwxrwx 1 root root     31 May  2 14:48 localtime -> /usr/share/zoneinfo/Asia/Taipei

# timedatectl
      Local time: Thu 2019-05-02 14:48:21 CST
  Universal time: Thu 2019-05-02 06:48:21 UTC
        RTC time: Thu 2019-05-02 06:48:22
       Time zone: Asia/Taipei (CST, +0800)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

在 ubuntu 系統下如果要列出已經安裝的套件
root@test3:~# apt list --installed

假設要看有 php 關鍵字的套件
root@test3:~# apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libapache2-mod-php7.2/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-common/bionic,bionic,now 1:60ubuntu1 all [installed,automatic]
php-curl/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-dev/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-fpm/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-gd/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-mbstring/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-mysql/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-pear/bionic-updates,bionic-updates,bionic-security,bionic-security,now 1:1.10.5+submodules+notgz-1ubuntu1.18.04.1 all [installed]
php-xml/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-xmlrpc/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-zip/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php7.2/bionic-updates,bionic-updates,bionic-security,bionic-security,now 7.2.17-0ubuntu0.18.04.1 all [installed,automatic]
php7.2-cli/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-common/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-curl/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-dev/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-fpm/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-gd/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-json/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-mbstring/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-mysql/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-opcache/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-readline/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-xml/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-xmlrpc/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
php7.2-zip/bionic-updates,bionic-security,now 7.2.17-0ubuntu0.18.04.1 amd64 [installed,automatic]
pkg-php-tools/bionic,bionic,now 1.35ubuntu1 all [installed,automatic]

undefined
Ubuntu 系統管理與架站實務(第三版)

作者: 施威銘研究室
出版社:旗標

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

修改 ubuntu 系統的 hostname
傳統的作法是修改 /etc/hostname
重新開機後生效

另外也可以使用 hostnamectl 指令可以不用開機就可以修改主機名稱
example:
root@test3:~# hostnamectl set-hostname myubuntu

這時候已經寫入設定檔了
root@test3:~# hostnamectl
   Static hostname: myubuntu

但是在 shell 看到的提示字串仍然是修改前的主機名稱
只要重新登入登出一次就可以了

root@test3:~# hostnamectl --help
hostnamectl [OPTIONS...] COMMAND ...

Query or change system hostname.

  -h --help              Show this help
     --version           Show package version
     --no-ask-password   Do not prompt for password
  -H --host=[USER@]HOST  Operate on remote host
  -M --machine=CONTAINER Operate on local container
     --transient         Only set transient hostname
     --static            Only set static hostname
     --pretty            Only set pretty hostname

Commands:
  status                 Show current hostname settings
  set-hostname NAME      Set system hostname
  set-icon-name NAME     Set icon name for host
  set-chassis NAME       Set chassis type for host
  set-deployment NAME    Set deployment environment for host
  set-location NAME      Set location for host

undefined
Ubuntu 系統管理與架站實務(第三版)

作者: 施威銘研究室  
出版社:旗標  
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

首先找到適合的作業系統
https://support.radware.com/app/answers/answer_view/a_id/16176/~/alteon-recommended-oids-for-snmp-monitoring

以 Alteon version 30.2 為例
假設我們要抓取 Peak SSL capacity usage in CPS 及 Current SSL capacity usage in CPS

分別可以下以下指令抓取
% /usr/local/bin/snmpwalk -v 2c -c COMMUNITY IP .1.3.6.1.4.1.1872.2.5.1.2.12.3
SNMPv2-SMI::enterprises.1872.2.5.1.2.12.3.0 = STRING: "500 CPS"

% /usr/local/bin/snmpwalk -v 2c -c COMMUNITY IP .1.3.6.1.4.1.1872.2.5.1.2.12.4
SNMPv2-SMI::enterprises.1872.2.5.1.2.12.4.0 = STRING: "124 CPS"
 


undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

編輯測試程式
# vi stdin.php
#!/usr/local/bin/php

<?php
$stdin = file ('php://stdin');
print_r ($stdin);

給予執行權限
# chmod u+x stdin.php

準備一個測試文字檔
# vi hello.txt
Hello
HelloWorld
helloworld
Hello World

測試,把文字檔cat 出來,丟給 php 程式處理
# cat hello.txt | ./stdin.php

Array
(
    [0] => Hello

    [1] => HelloWorld

    [2] => helloworld

    [3] => Hello World

)

參考資料
https://www.php.net/manual/en/features.commandline.io-streams.php

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

因為 unix 和 windows 的換行符號不一樣
unix/linux 換行符號 \n
windows 換行符號 \r\n

所以如果直接拿windows 編輯的檔案到linux 下用vi 開啟
會發現換行地方會多出 ^M 

可以利用 tr 指令來去除多餘的 ^M 符號
cat dos.txt | tr -d '\r' > unix.txt
或是
tr -d '\r' < dos.txt > unix.txt

undefined
Linux Shell 程式設計與管理實務 [第三版]

作者: 臥龍小三  
出版社:博碩  
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

MRBS (Meeting Room Booking System) 是一套由 PHP 開發的會議室預約系統
官網:
https://mrbs.sourceforge.io/
下載位置:
https://sourceforge.net/projects/mrbs/files/
官網DEMO 圖片
MRBS - open source 會議室預約系統

目前最新的版本為 1.7.3
系統需求:
- PHP 5.4.0 or above with MySQL and/or PostgreSQL support
- MySQL (5.5.3 and above) or PostgreSQL 8.2 or above.
- Any web server that is supported by PHP

解壓縮完的目錄結構為
mrbs-1.7.3/
 -> web/

mrbs-1.7.3/ 主要放mrbs 相關設定
請將 apache 的 DoucumentRoot 指向 mrbs-1.7.3/web/

MRBS 支援 DB、LDAP、pop3... 等多種的認證方式
如果要使用MySQL 作為帳號系統,請先執行 tables.my.sql
假設企業內部有現成的 LDAP 或是mail server , 建議可以整合內部的LDAP、ipop3 對於使用者來的好處是,不用再去重新申請帳號或記住多組的帳號密碼,同時也可以降低管理者的負擔

修改方式
vi web/config.inc.php
$auth["type"] = "auth type";

另外還有很多可以客製化修改的參數請參考
web/systemdefaults.inc.php

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

這幾天透過esx 6.5 的 web ui 要mount 一個 nfs 的 datastore
已經確定 nfs server 設定正常,但就是mount 不起來

以下各種各式各樣的錯誤噴出來
Failed to mount NFS datastore shared - The specified key, name, or identifier '/vmfs/volumes/15xxxxxx-a3xxxxxx' already exists. - dismiss
Failed to mount NFS datastore shared - Operation failed, diagnostics report: Unable to get console path for volume, shared - dismiss
Failed to mount NFS datastore shared - The specified key, name, or identifier 'shared' already exists

最後只好透過 cli 指令來新增一個 datastore

[root@esx-lab:~] esxcfg-nas -a shared -o 192.168.1.1 -s /vol/shared

df -h 查看是否 mount成功
最後重開機測試是否會自動 mount 

esxcfg-nas 參數
esxcfg-nas <options> [<label>]
-a|--add                Add a new NAS filesystem to /vmfs volumes.
                        Requires --host and --share options.
                        Use --readonly option only for readonly access.
-o|--host <host>        Set the host name or ip address for a NAS mount.
                        For version 4.1, can be a comma-separated list.
-s|--share <share>      Set the name of the NAS share on the remote system.
-y|--readonly           Add the new NAS filesystem with readonly access.
-d|--delete             Unmount and delete a filesystem.
-l|--list               List the currently mounted NAS file systems.
-v|--version <version>  Specify NFS version (3 or 4.1)
                        Required for add; optional for list.
-U|--user <user>        Set per host NFS user and password
                        Requires --version 4.1 option
-C|--user-clear         Clear per host NFS user and password
                        Requires --version 4.1 option
-L|--user-list          List per host NFS user and number of passwords
                        Requires --version 4.1 option
-r|--restore            Restore all NFS version 3 mounts from the configuration file.
                        (FOR INTERNAL USE ONLY).
-h|--help               Show this message.

undefined
VMware vSphere 6.7私有雲建置實戰

作者: 顧武雄  
出版社:碁峰  
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

1. 在 shell 下輸入 dpkg-reconfigure tzdata
2. 依序選擇 Asia -> Taipei 即可




undefined
Ubuntu 系統管理與架站實務(第三版)

作者: 施威銘研究室  
出版社:旗標  
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

1. 在控制台中找到 "設定時間和日期"

2. 選擇網際網路頁籤,並點擊變更設定

3. 在伺服器欄位中輸入你想要跟哪一台 ntp server 校時

4. 確定

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

新買的 win 10 桌機或是筆電
如果要連上只支援 SMBv1 的 NAS 或是 samba server 的時候
可能會出現以下的錯誤訊息
"因為檔案共用不安全,所以無法連線。此共用需要過時的 SMB1 通訊協定,而這個通訊協定既不安全,而且可能使您的系統容易受到攻擊
您的系統需要 SMB2 或是更高版本"

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

Networking -> TCP/IP stacks -> Default TCP/IP stack -> Edit settings

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

安裝 pptpclient
cd /usr/ports/net/pptpclient/
make install clean 

編輯設定檔
vi /etc/ppp/ppp.conf

myvpn:
 set authname testuser  #登入帳號
 set authkey  1234    #登入密碼
 set timeout 0
 set ifaddr 0 0
 add 10.0.0.0/8 hisaddr
 add 172.16.0.0/12 hisaddr
 alias enable yes
 disable ipv6cp

建立連線
nohup pptp vpn-server-ip-or-hostname myvpn &

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

在 FreeBSD 啟用 snmpd 有兩個方式
安裝 /usr/ports/net-mgmt/net-snmp/

或是使用內建的 bsnmpd
設定檔路徑: /etc/snmpd.config
用自己習慣的編輯器修改 /etc/rc.conf
方便下次重開機後自動啟動

vi /etc/rc.conf
bsnmpd_enable="YES"

或是在shell 下輸入
sysrc bsnmpd_enable=YES

第一次手動啟動:
/etc/rc.d/bsnmpd restart
Stopping bsnmpd.
Waiting for PIDS: 43104.
Starting bsnmpd.

undefined
資安風險評估指南(第三版)

Network Security Assessment, 3E
作者: Chris McNab  
譯者: 江湖海
出版社:歐萊禮  
出版日期:2017/09/08
語言:繁體中文
定價:780元

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

安裝好 pfsense 後 
在瀏覽器輸入
http://lan-ip/
預設帳號密碼是: admin/pfSense
建議馬上更新新的密碼

測試環境
OS: pfSense-CE-2.4.4-RELEASE-p1-amd64
Site A
public ip: 10.1.1.1
lan ip: 192.168.100.254

Site B:
public ip: 10.2.2.2
lan ip: 192.168.200.254

如果是建立 site to site openvpn
首先要定義好 server 和 client
本次的環境是以site A 為 server 端
site B 為 client 端

[ Site A config ]
VPN -> OpenVPN -> Servers -> Add
以下幾個欄位稍微注意一下,剩下的幾乎都用預設值即可
Server mode: Peer to Peer (Shared Key)
Description: Site-A-Server
IPv4 Tunnel Network: 172.16.0.252/30 (兩個site 之間的vpn 路由)
IPv4 Remote network(s): 192.168.200.0/24
存檔

[ Site B config ]
VPN -> OpenVPN -> Clients -> Add
Server mode: Peer to Peer (Shared Key)
Description: Site-B-Client
Auto generate: uncheck
回到Site-A 設定,複製Shared Key 到 Site-B
IPv4 Tunnel Network: 172.16.0.252/30 (兩個site 之間的vpn 路由)
IPv4 Remote network(s): 192.168.100.0/24

防火牆rule 設定
Firewall -> Rules -> OpenVPN -> Add
Protocol : Any
存檔

檢視VPN 連線狀態
Status -> OpenVPN

最後測試兩邊的電腦是否都可以透過lan network互相連線
收工


undefined

文章標籤

helloworld 發表在 痞客邦 留言(1) 人氣()

Close

您尚未登入,將以訪客身份留言。亦可以上方服務帳號登入留言

請輸入暱稱 ( 最多顯示 6 個中文字元 )

請輸入標題 ( 最多顯示 9 個中文字元 )

請輸入內容 ( 最多 140 個中文字元 )

reload

請輸入左方認證碼:

看不懂,換張圖

請輸入驗證碼