網頁

顯示具有 系統校調 標籤的文章。 顯示所有文章
顯示具有 系統校調 標籤的文章。 顯示所有文章

2020年10月30日 星期五

設定DNS集中化的細節

 gmail dkim 設定

https://support.google.com/a/answer/174124?hl=zh-Hant

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

https://blog.toright.com/posts/6232/email-verify-domain-spf.html

https://www.opencli.com/linux/bind-dns-create-spf-record


2019年11月28日 星期四

moodle update

apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
apt-get update

dpkg -l | grep php | tee packages.txt

apt install libapache2-mod-php7.2 php-common php7.2 php7.2-cli php7.2-common  php7.2-curl php7.2-gd php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pspell php7.2-readline php7.2-soap php7.2-xml  php7.2-xmlrpc php7.2-zip php7.2-fpm


a2enconf php7.2
a2enmod php7.2

sudo apt purge php7.0*

2018年7月28日 星期六

電腦教室環境備分還原Clonezilla與軟體廣播Veyon--2

軟體廣播Veyon --- 學生機安裝



電腦教室環境備分還原Clonezilla與軟體廣播Veyon--1

1.Clonezilla再生龍介紹 
https://clonezilla.nchc.org.tw/news/

2.Clonezilla再生龍電腦教室的派送 
麻煩參考前一篇

3.Veyon軟體廣播介紹 
iTalc的更新版(替代版)
https://veyon.io/
教師可以從教師電腦遙距操控電腦室內的學生電腦,
包括以下動作:監察、控制、關閉、演示及開機/關機等。
我最喜歡用的是擷取所有學生畫面。

4.Veyon軟體廣播安裝(教師機與學生機) 
5.Veyon軟體廣播使用

同場加映:UWF

電腦教室環境備分還原Clonezilla-4

電腦教室的系統派送-- Clonezilla-Server


2016年12月7日 星期三

OpenLdap 安裝設定

wwh@Ldap:/etc/ldap$ sudo vi base.ldif

-----------base.ldif內容------------------------------------------------------------------
# create new
# change to your own suffix for the field 'dc=lnes,dc=tp,dc=edu,dc=tw'
dn: ou=people,dc=lnes,dc=tp,dc=edu,dc=tw
objectClass: organizationalUnit
ou: people

dn: ou=teachers,dc=lnes,dc=tp,dc=edu,dc=tw
objectClass: organizationalUnit
ou: teachers

dn: ou=s100,dc=lnes,dc=tp,dc=edu,dc=tw
objectClass: organizationalUnit
ou: s100

dn: ou=s101,dc=lnes,dc=tp,dc=edu,dc=tw
objectClass: organizationalUnit
ou: s101

dn: ou=s102,dc=lnes,dc=tp,dc=edu,dc=tw
objectClass: organizationalUnit
ou: s102

dn: ou=s103,dc=lnes,dc=tp,dc=edu,dc=tw
objectClass: organizationalUnit
ou: s103

-----------base.ldif結束------------------------------------------------------------------

以下這一段是將base.ldif的檔案內容,將一些群組(people,teachers,s100,s101,s102,s103)加入伺服器

wwh@Ldap:/etc/ldap$ ldapadd -x -D cn=admin,dc=lnes,dc=tp,dc=edu,dc=tw -W -f base.ldif
Enter LDAP Password:
adding new entry "ou=people,dc=lnes,dc=tp,dc=edu,dc=tw"

adding new entry "ou=teachers,dc=lnes,dc=tp,dc=edu,dc=tw"

adding new entry "ou=s100,dc=lnes,dc=tp,dc=edu,dc=tw"

adding new entry "ou=s101,dc=lnes,dc=tp,dc=edu,dc=tw"

adding new entry "ou=s102,dc=lnes,dc=tp,dc=edu,dc=tw"

adding new entry "ou=s103,dc=lnes,dc=tp,dc=edu,dc=tw"




wwh@Ldap:/etc/phpldapadmin$ sudo vi config.php

-----------config.php內容------------------------------------------------------------------
將前面的註釋去掉。
$servers->setValue('server','host','127.0.0.1');
$servers->setValue('server','port',389);

修改: 在array中輸入設置的olcSuffix。
$servers->setValue('server','base',array(''));
$servers->setValue('server','base',array('dc=lnes,dc=tp,dc=edu,dc=tw'));

將前面的註釋去掉。
$servers->setValue('login','auth_type','session');

-----------config.php結束-----------------------------------------------------

2016年12月5日 星期一

擴充pve 下的 debian 磁區大小

現在pve下的控制台 resize disk



wwh@cms:~$ sudo dmesg | grep vda

[    0.620525]  vda: vda1 vda2 < vda5 >
[    1.331007] EXT4-fs (vda1): mounting ext2 file system using the ext4 subsystem
[    1.334246] EXT4-fs (vda1): mounted filesystem without journal. Opts: (null)

wwh@cms:~$ sudo fdisk -l /dev/vda | grep ^/dev
/dev/vda1  *      2048   499711   497664  243M 83 Linux
/dev/vda2       501758 41940991 41439234 19.8G  5 Extended
/dev/vda5       501760 41940991 41439232 19.8G 8e Linux LVM


wwh@cms:~$ sudo parted /dev/vda
GNU Parted 3.2
Using /dev/vda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 236GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  256MB   255MB   primary   ext2         boot
 2      257MB   21.5GB  21.2GB  extended
 5      257MB   21.5GB  21.2GB  logical                lvm


(parted) resizepart 5 100%
Error: Can't have overlapping partitions.
此錯誤是因2是擴充詞區,5是邏輯磁碟,所以需要先擴充2,再擴充5。

(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 236GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  256MB   255MB   primary   ext2         boot
 2      257MB   21.5GB  21.2GB  extended
 5      257MB   21.5GB  21.2GB  logical                lvm

(parted) resizepart 2 100%
(parted) resizepart 5 100%
(parted) quit
Information: You may need to update /etc/fstab.


wwh@cms:~$ sudo fdisk -l /dev/vda | grep ^/dev
/dev/vda1  *      2048    499711    497664   243M 83 Linux
/dev/vda2       501758 461373439 460871682 219.8G  5 Extended
/dev/vda5       501760 461373439 460871680 219.8G 8e Linux LVM


wwh@cms:~$ sudo pvresize /dev/vda5

wwh@web:~$ sudo pvresize /dev/vda5
  Physical volume "/dev/vda5" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized



參考資料:https://pve.proxmox.com/wiki/Resize_disks


但是這樣還是沒有變大??

wwh@cms:~$ sudo pvs
[sudo] password for wwh:
  PV         VG    Fmt  Attr PSize   PFree
  /dev/vda5  D8-vg lvm2 a--  219.76g 200.00g

wwh@cms:~$ sudo vgs
  VG    #PV #LV #SN Attr   VSize   VFree
  D8-vg   1   2   0 wz--n- 219.76g 200.00g

wwh@cms:~$ sudo lvs
  LV     VG    Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   D8-vg -wi-ao----  18.91g
  swap_1 D8-vg -wi-ao---- 872.00m


wwh@cms:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0        19G  967M   17G   6% /
udev             10M     0   10M   0% /dev
tmpfs           794M  8.4M  785M   2% /run
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1       236M   33M  191M  15% /boot

wwh@cms:~$ sudo fdisk -l /dev/vda | grep ^/dev
/dev/vda1  *      2048    499711    497664   243M 83 Linux
/dev/vda2       501758 461373439 460871682 219.8G  5 Extended
/dev/vda5       501760 461373439 460871680 219.8G 8e Linux LVM

--------這一段是錯誤示範(是我不會作亂弄的)------------------------------------------------------------


wwh@cms:~$ sudo lvresize -L+200G --resizefs /dev/dm-0
  Path required for Logical Volume "dm-0"
  Please provide a volume group name
  Run `lvresize --help' for more information.
wwh@cms:~$ sudo lvresize -L+200G --resizefs /dev/vda2
  Path required for Logical Volume "vda2"
  Please provide a volume group name
  Run `lvresize --help' for more information.

所以既不是dm-0 也不是vda2

--------  這一段是錯誤示範  ------------------------------------------------------------

那到底是??

wwh@cms:~$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/vda5
  VG Name               D8-vg
  PV Size               219.76 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              56258
  Free PE               51200
  Allocated PE          5058
  PV UUID               cC963w-****-****-****-PMdI-VPpH-McB99G

wwh@cms:~$ sudo vgdisplay | grep Name
  VG Name               D8-vg


wwh@cms:~$ sudo lvdisplay | grep Path
  LV Path                /dev/D8-vg/root
  LV Path                /dev/D8-vg/swap_1


終於找到正確的 LV Path

wwh@cms:~$ sudo lvextend -l +100%FREE /dev/D8-vg/root
  Size of logical volume D8-vg/root changed from 18.91 GiB (4840 extents) to 218.91 GiB (56040 extents).
  Logical volume root successfully resized


wwh@cms:~$ sudo resize2fs /dev/D8-vg/root
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/D8-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 14
The filesystem on /dev/D8-vg/root is now 57384960 (4k) blocks long.

wwh@cms:~$ df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       216G  982M  206G   1% /
udev             10M     0   10M   0% /dev
tmpfs           794M  8.4M  785M   2% /run
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1       236M   33M  191M  15% /boot


終於弄對了!!


開機修改第一步

改ip

sudo vi /etc/network/interfaces Enter
auto lo 
iface lo inet loopback 

auto eth0 
iface eth0 inet static # 固定 (靜態) IP。 
address 140.127.ooo.xxx # IP 位址。 
netmask 255.255.255.0 # 網路遮罩。 
gateway 140.127.qqq.ppp # 預設閘道。

改電腦名稱

# hostname
server01

用 hostname 指令修改的 hostname 只會臨時有效, 當重新啟動系統後便會用回原來的 hostname, 要永久生效, 可以修改 /etc/named 檔案:
# vi /etc/hostname

將 “server01” 改成 “server02”, 並儲存檔案, 然後開啟 /etc/hosts 檔案:
# vi /etc/hosts

最後輸入以下指令, 便會直接讀入 /etc/hostname 的內容並立即更新 hostname, 而不用 hostname 指令都可以:
# /etc/init.d/hostname.sh start

2016年11月3日 星期四

Proxmox upgrade

原本安裝的 Proxmox 是4.2版,裝在 Debian 8 上,

嘗試更新版本

先在console 設定

編輯sources.list,
並加入deb http://download.proxmox.com/debian jessie pve-no-subscription

編輯 /etc/apt/sources.list.d/pve-enterprise.list

# deb https://enterprise.proxmox.com/debian jessie pve-enterprise

之後在 web 的 控制頁面, Updates頁面下,可以按 Refresh 之後出現可以更新的套件,就可以按下Upgrade,電腦會自動開啟Console 進行更新。



2016年10月13日 星期四

Win Updates Disabler 一鍵關閉Windows 更新

http://download.sofree.cc/win-updates-disabler.html

軟體介紹:
Win Updates Disabler 是一個非官方支援Windows一鍵關閉Windows更新、關閉安全中心、關閉Windows防火牆軟體、關閉Windows Defender的免費軟體,支援Windows XP、Windows 7、Windows 8、Windows 10等作業系統,方便使用者管理電腦更新與系統設定。

軟體下載:[安裝版]、[免安裝]

2016年7月15日 星期五

apache建立虛擬站台

先在/etc/apache2/sites-available/xxxx.conf建立設定檔
執行 sudo a2ensite xxxx.conf
systemctl apache2 restart

2016年4月18日 星期一

owncloud 的Let's Encrypt 實做紀錄

Let’s Encrypt 的 SSL 憑證安裝

Let’s Encrypt 提供免費的 SSL 憑證可以申請,每把憑證的期限只有三個月。

Let’s Encrypt 安裝步驟

  1. git clone https://github.com/letsencrypt/letsencrypt
  2. cd letsencrypt
  3. ./letsencrypt-auto (需要 sudo 的權限。)

Requesting root privileges to run letsencrypt...

   /root/.local/share/letsencrypt/bin/letsencrypt



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

    Which names would you like to activate HTTPS for?                   (如果有多網站)

 ------------------------------------------------------------------------------------------------------
   x x                  [*] xoops.lnes.tp.edu.tw                        x x
   x x                  [*] moodle.lnes.tp.edu.tw                       x x
   x x                  [*] owncloud.lnes.tp.edu.tw                     x x
------------------------------------------------------------------------------------------------------
  ------------------------------------------------------------------------------------------------------
   x                     <  OK  >           <Cancel>                      x
 ------------------------------------------------------------------------------------------------------

   ------------------------------------------------------------------------------------------------------
 Please choose whether HTTPS access is required or optional.          x
 ------------------------------------------------------------------------------------------------------
   x x    Easy    Allow both HTTP and HTTPS access to these sites   (如果同時要加密或不加密)
   x x    Secure  Make all requests redirect to secure HTTPS access   )(全數要加密)
 ------------------------------------------------------------------------------------------------------

   ------------------------------------------------------------------------------------------------------
   x                     <  OK  >           <Cancel>                      x
   ------------------------------------------------------------------------------------------------------

   ------------------------------------------------------------------------------------------------------
   x Congratulations! You have successfully enabled                       x
   x https://xoops.lnes.tp.edu.tw, https://moodle.lnes.tp.edu.tw, and     x
   x https://owncloud.lnes.tp.edu.tw                                      x
   x                                                                      x
   x You should test your configuration at:                               x
   x https://www.ssllabs.com/ssltest/analyze.html?d=xoops.lnes.tp.edu.tw  x
   x https://www.ssllabs.com/ssltest/analyze.html?d=moodle.lnes.tp.edu.tw x
   x https://www.ssllabs.com/ssltest/analyze.html?d=owncloud.lnes.tp.edu. x
   x tw                                                                   x
     ------------------------------------------------------------------------------------------------------

   x                               <  OK  >                               x
     ------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------
    Enter email address (used for urgent notices and lost key recovery)  x
 ------------------------------------------------------------------------------------------------------
    wwh@cc.lnes.tp.edu.tw                                              
------------------------------------------------------------------------------------------------------
  ------------------------------------------------------------------------------------------------------
                     <  OK  >           <Cancel>                     
  ------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------
   x Please read the Terms of Service at                                  x
   x https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf. You x
   x must agree in order to register with the ACME server at              x
   x https://acme-v01.api.letsencrypt.org/directory                       x
 ------------------------------------------------------------------------------------------------------
   x                     <Agree >           <Cancel>                      x
   ------------------------------------------------------------------------------------------------------
  • 預設會將 Key、憑證 產生在這邊:/etc/letsencrypt/live/owncloud.lnes.tp.edu.tw/
  • Key、憑證 的實體路徑:/etc/letsencrypt/archive/$DOMAIN ,再 ln 到 /etc/letsencrypt/live/$DOMAIN
產生的憑證如下述:
  • privkey.pem:Private key for the certificate.
    This is what Apache needs for SSLCertificateKeyFile, and nginx for sslcertificatekey.
  • cert.pem:Server certificate only.
    This is what Apache needs for SSLCertificateFile.
  • chain.pem:All certificates that need to be served by the browser excluding server certificate, i.e. root and intermediate certificates only.
    This is what Apache needs for SSLCertificateChainFile.
  • fullchain.pem:All certificates, including server certificate. This is concatenation of chain.pem and cert.pem.
    This is what nginx needs for ssl_certificate.
Apache2 設定 Let’s Encrypt SSL 的步驟

vim /etc/apache2/sites-enabled/xxx.conf
<IfModule mod_ssl.c>
    <VirtualHost *:443>    
 # ....     
# Let's encrypt     SSLCertificateFile /etc/letsencrypt/live/owncloud.lnes.tp.edu.tw/cert.pem     SSLCertificateKeyFile /etc/letsencrypt/live/owncloud.lnes.tp.edu.tw/privkey.pem     SSLCertificateChainFile /etc/letsencrypt/live/owncloud.lnes.tp.edu.tw/chain.pem     SSLCACertificateFile /etc/letsencrypt/live/owncloud.lnes.tp.edu.tw/fullchain.pem    
 # ....     </VirtualHost>

sudo service apache2 restart


SSL Key 三個月自動更新的 Crontab 設定

  1. sudo service apache2 stop
  2. cd letsencrypt
  3. ./letsencrypt-auto certonly -t -d DOMAIN -m user@gmail.com --renew-by-default --agree-tos --agree-dev-preview
  4. sudo service apache2 start

2015年12月1日 星期二

Debain Jessie 安裝 nginx

For Debian/Ubuntu, in order to authenticate the nginx repository signature and to eliminate warnings about missing PGP key during installation of the nginx package, it is necessary to add the key used to sign the nginx packages and repository to the apt program keyring. Please download this key from our web site, and add it to the apt program keyring with the following command:
sudo apt-key add nginx_signing.key
For Debian replace codename with Debian distribution jessie, and append the following to the end of the/etc/apt/sources.list file:
deb http://nginx.org/packages/debian/ jessie nginx
deb-src http://nginx.org/packages/debian/ jessie nginx
apt-get update 
apt-get install nginx

參考資料

其他