close

參考文獻:
https://blog.xuite.net/yh96301/blog/242333268
https://tw511.com/a/01/885.html
 

1. rufus做開機USB stick。資料分割配置要選GPT格式。

2. 進BIOS使用UEFI USB開機。

3. 設定網路卡。

4. 語言選中文。 用英文介面安裝,速度快又穩。不要一開始就選中文。

5. 選擇最小安裝,同時下載更新、安裝第三方軟體(drivers)

6. 開機碟分割:沒有設好的話安裝會失敗。512M的SSD。
a. EFI
b. /boot: 1000MB  
c. /: 300G ext4
d. /home: 200G ext4
e. 在另一顆HD上,劃了 6000MB swap。

6. 開始安裝。每次重安裝一定要重劃partition,而且/boot與efi一定要劃好,不然安裝時就會失敗,安裝完也無法正常開機。

7. 安裝完成後重開機。

- 重設網路為static, # apt install net-tools
- 軟體更新,裝完之後立即重新啟動。# apt-get update #apt-get upgrade
- 自動安裝了新酷注音輸入法
- 切成英文模式

8. 安裝ssh:都在Terminal中安裝。
# dpkg -l |grep ssh
# apt install openssh-server
安裝成功立刻就可以用了。

9. 修改網路設定。
# vi /etc/hosts

127.0.0.1       localhost
#127.0.1.1      rdwks
192.168.1.201   helioserp helioserp.helios.com
192.168.1.202   rdwks rdwks.helios.com
192.168.1.243   heliosef heliosef.helios.com

# vi /etc/resolv.conf

#nameserver 127.0.0.53
domain helios.com
nameserver 192.168.1.201
nameserver 168.95.1.1
options edns0 trust-ad

10. 安裝chronyd  : https://kknews.cc/zh-tw/code/kv6kkeb.html
https://luyaku.pixnet.net/blog/post/351850105-centos-8.1-03%EF%BC%9Achrony%E5%8F%96%E4%BB%A3ntp

註記:因為有些設備還是只會認得ntp,建議還是要加裝ntp。

# apt install chrony
# vi /etc/chrony/chrony.conf

server tock.stdtime.gov.tw prefer
server tick.stdtime.gov.tw iburst maxsources 1
server time.stdtime.gov.tw iburst maxsources 1

allow 192.168.0.0/16
:x

# systemctl restart chrony.service
# systemctl status chrony.service
● chrony.service - chrony, an NTP client/server
     Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset:
     Active: active (running) since Wed 2020-12-23 10:47:58 CST; 5s ago
       Docs: man:chronyd(8)
             man:chronyc(1)
             man:chrony.conf(5)
    Process: 8802 ExecStart=/usr/lib/systemd/scripts/chronyd-starter.sh $DAEMON_
    Process: 8821 ExecStartPost=/usr/lib/chrony/chrony-helper update-daemon (cod
   Main PID: 8818 (chronyd)
      Tasks: 2 (limit: 77003)
     Memory: 4.0M
     CGroup: /system.slice/chrony.service
             ├─8818 /usr/sbin/chronyd -F -1
             └─8819 /usr/sbin/chronyd -F -1

12月 23 10:47:58 rdwks systemd[1]: Starting chrony, an NTP client/server...
12月 23 10:47:58 rdwks chronyd[8818]: chronyd version 3.5 starting (+CMDMON +NTP
12月 23 10:47:58 rdwks chronyd[8818]: Frequency -0.425 +/- 1.335 ppm read from /
12月 23 10:47:58 rdwks chronyd[8818]: Loaded seccomp filter
12月 23 10:47:58 rdwks systemd[1]: Started chrony, an NTP client/server.
12月 23 10:48:02 rdwks chronyd[8818]: Selected source 118.163.81.62

# chronyc sourcestats

210 Number of sources = 3
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
211-22-103-157.HINET-IP.>   2   0    64     -0.002   2000.000   -130us  4000ms
118-163-81-62.HINET-IP.h>   5   3    71     -0.560     60.992   -108us   149us
118-163-81-61.HINET-IP.h>   5   3    71     +1.988     60.113   +163us   280us

成功執行安裝。

 

新增使用者:https://www.itread01.com/p/193591.html
# adduser username
輸入密碼,就會新增/home和視窗介面。

 

安裝Samba:
https://magiclen.org/ubuntu-server-samba/
https://tsaiyuyan.github.io/2019/04/09/ubuntu-she-ding-samba-fen-xiang-dang-an/
https://www.itread01.com/content/1550441893.html

# apt-get install samba  <<<光是安裝好,在console上設定成分享,就可以用了。但這樣做好的samba只有第一個使用者可以開分享,其他使用者不行。所以要繼續進行後續設定。

# smbpasswd -a username   <<<這個使用者要先建好。用上面的adduser新增使用者。
New SMB password:
Retype new SMB password:
Added user steventsai.
# smbpasswd -e username <<<要啟用。
Enabled user username.

開好某一個特定的foler,設成分享。

# vi /etc/samba/smb.conf
[tsaishare]
path = /home/username/sh
public = yes
writable = yes
valid users = username
create mask = 0644
force create mode = 0644
directory mask = 0755
force directory mode = 0755
available = yes
:x

# systemctl restart smbd

就可以順利分享該目錄了,圖形介面完全不用動到。如果windows PC端看不見,windows這端重開機後就看得到了。

------------如果使用/etc/samba/smb.conf設定,以下都不用做。--------------------

原本的/var/lib/samba/usershares權限如下:
圖片
這樣新增的使用者是不能開sharefolder的。

原本的/etc/group是這樣:
# vi group
sambashare:x:132:username


# usermod --append --groups sambashare username
sambashare:x:132:username,username2

# chmod 777 /var/lib/samba/usershares  <<<就會變成開foldersharing時沒有錯誤訊息,但在windows中一片空白。

============圖形介面  這段有問題。===============

到console下,在該使用者名字下,新增一個目錄,按右鍵properties>>Permissions: Group改為sambashare>>>Local Network Share三個勾都勾起來。
 

============Window 10===============

在windows端,開啟檔案管理員>>>點網路>>>開啟共用>>>上方輸入該主機的ip,下面會出現ShareFolder
圖片
按右鍵連線網路磁碟機:使用不同的認證一定要打勾!因為這不是用windows的認證。
圖片

因為本機沒有加入AD,所以使用者名稱要打:.\<username> 或是前面打<windows的主機名稱>\<smb使用者名稱>,密碼是剛剛smbpasswd上設定的密碼,就可以連線成功。

圖片

 

安裝Xrdp (遠端桌面)

# vi /etc/samba/smb.conf
root@rdwks:/etc/chrony# apt update
已有:1 http://tw.archive.ubuntu.com/ubuntu focal InRelease
已有:2 http://tw.archive.ubuntu.com/ubuntu focal-updates InRelease
已有:3 http://tw.archive.ubuntu.com/ubuntu focal-backports InRelease
下載:4 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
下載:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [24.3 kB]
下載:6 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [56.6 kB]
取得 190 kB 用了 2s (97.8 kB/s)
正在讀取套件清單... 完成
正在重建相依關係
正在讀取狀態資料... 完成
所有套件都是最新。

# apt install ubuntu-desktop

正在讀取套件清單... 完成
正在重建相依關係
正在讀取狀態資料... 完成
ubuntu-desktop 已是最新版本 (1.450.2)。
以下套件為自動安裝,並且已經無用:
  libfprint-2-tod1
使用 'sudo apt autoremove' 將之移除。
升級 0 個,新安裝 0 個,移除 0 個,有 0 個未被升級。

# apt install -y xrdp  安裝完成。

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfprint-2-tod1
Use 'sudo apt autoremove' to remove it.

Processing triggers for systemd (245.4-4ubuntu3.3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...

# adduser xrdp ssl-cert
Adding user `xrdp' to group `ssl-cert' ...
Adding user xrdp to group ssl-cert
Done.

# systemctl restart xrdp
# systemctl status xrdp
● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: >
     Active: active (running) since Wed 2020-12-23 11:26:22 CST; 4s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
    Process: 12989 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited,>
    Process: 13003 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=>
   Main PID: 13005 (xrdp)
      Tasks: 1 (limit: 77003)
     Memory: 2.2M
     CGroup: /system.slice/xrdp.service
             └─13005 /usr/sbin/xrdp

12月 23 11:26:21 rdwks xrdp[13003]: (13003)(140681752147776)[INFO ] address [0.>
12月 23 11:26:21 rdwks xrdp[13003]: (13003)(140681752147776)[INFO ] listening t>
12月 23 11:26:21 rdwks xrdp[13003]: (13003)(140681752147776)[INFO ] xrdp_listen>
12月 23 11:26:21 rdwks xrdp[13003]: (13003)(140681752147776)[DEBUG] Closed sock>
12月 23 11:26:21 rdwks systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: Operation not permitted
12月 23 11:26:22 rdwks systemd[1]: Started xrdp daemon.
12月 23 11:26:23 rdwks xrdp[13005]: (13005)(140681752147776)[INFO ] starting xr>
12月 23 11:26:23 rdwks xrdp[13005]: (13005)(140681752147776)[INFO ] address [0.>
12月 23 11:26:23 rdwks xrdp[13005]: (13005)(140681752147776)[INFO ] listening t>
12月 23 11:26:23 rdwks xrdp[13005]: (13005)(140681752147776)[INFO ] xrdp_listen>
lines 1-23/23 (END)...skipping...

# ufw allow from 192.168.0.0/16 to any port 3389    <<<開啟防火牆
Rules updated

# reboot

一定要重開機才會啟動。不用改任何設定。因為它每次都會登入同一個session,所以如果已經登入一個(不論在console上或是xrdp上),另一個就會開不起來。win10端也要重開機。

 

Xrdp中移除authentication required dialog box: http://c-nergy.be/blog/?p=13641

# vi /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla

[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes

[Allow Package Management all Users]
Identity=unix-user:*
Action=org.debian.apt.*;io.snapcraft.*;org.freedesktop.packagekit.*;com.ubuntu.update-notifier.*
ResultAny=no
ResultInactive=no
ResultActive=yes

:x

# systemctl restart xrdp

再重新用遠端桌面登入,就不會再要authentication了。

 

安裝Anaconda:https://officeguide.cc/ubuntu-linux-install-anaconda-data-science-platform-tutorial/
安裝注意:不要用root安裝。會變成大家都不能用。

-----------cmd mode install---------------

# apt-get install curl

Reading package lists... Done
Building dependency tree
Reading state information... Done
...............

Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ... 安裝完成。

$ curl -O https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  528M  100  528M    0     0  10.9M      0  0:00:48  0:00:48 --:--:-- 10.7M
圖片

$ sha256sum Anaconda3-2020.11-Linux-x86_64.sh   <<<檢查版本。
cf2ff493f11eaad5d09ce2b4feaa5ea90db5174303d5b3fe030e16d29aeef7de  Anaconda3-2020.11-Linux-x86_64.sh

  <<<如果全文字介面的話要裝,我用browser已經下載好個人使用版本。
圖片

$ bash Anaconda3-2020.11-Linux-x86_64.sh 

Welcome to Anaconda3 2020.11

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>> ......

Do you accept the license terms? [yes|no]
[no] >>> yes

Anaconda3 will now be installed into this location: 
/root/anaconda3 

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/anaconda3] >>> /home/steventsai/anaconda3  <<<修改安裝目錄。

PREFIX=/home/steventsai/anaconda3
Unpacking payload ...

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes

$ source .bashrc  <<<呼叫環境變數。如果是其他使用者也要呼叫這個環境變數。

(base) steventsai@rdwks:~$ conda info   <<<前面出現base才可以用喔。

     active environment : base
    active env location : /home/steventsai/anaconda3
            shell level : 1
       user config file : /home/steventsai/.condarc
 populated config files : /home/steventsai/.condarc
          conda version : 4.9.2
    conda-build version : 3.20.5
         python version : 3.8.5.final.0
       virtual packages : __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/steventsai/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/steventsai/anaconda3/pkgs
                          /home/steventsai/.conda/pkgs
       envs directories : /home/steventsai/anaconda3/envs
                          /home/steventsai/.conda/envs
               platform : linux-64
             user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.5 Linux/5.4.0-                                                                             58-generic ubuntu/20.04.1 glibc/2.31
                UID:GID : 1001:1001
             netrc file : None
           offline mode : False

(base) steventsai@rdwks:~$ /home/steventsai/anaconda3/bin/anaconda-navigator  第一次使用會出現下面錯誤訊息:
#
# Please activate the conda root environment properly before running the
# 'anaconda-navigator' command.
#
# To activate the environment please open a terminal and run:
#
# . /home/steventsai/anaconda3/bin/activate root
#
# For more information please see the documentation at:
#
# https://docs.anaconda.com/anaconda/navigator/
#

$ . /home/steventsai/anaconda3/bin/activate root
$ /home/steventsai/anaconda3/bin/anaconda-navigator

就可以開啟圖形介面了。

 

新增圖型shortcut: https://dannyda.com/2020/03/21/how-to-create-shortcut-icon-for-anaconda-anaconda3-navigator-launch-anaconda-navigator-in-linux-debian-ubuntu-kali-linux/

$ cd ~/Desktop
$ vi anaconda-navigator.desktop   <<<注意,安裝路徑要對,python3.x版本要對,不然沒有圖。

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Anaconda
Version=3.0
Type=Application
Exec=/home/username/anaconda3/bin/anaconda-navigator
Icon=/home/steventsai/anaconda3/lib/python3.8/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png
Comment=Open Anaconda Navigator
Terminal=false

:x  <<存檔退出。

$ cp anaconda-navigator.desktop ~/.local/share/applications/    <<<將檔案copy到正確的路徑下,點開上方的「概覽」就可以看到Anaconda的圖了。直接點就打開。

若是其他使用者要用,請將.bashrc和/Desktop/anaconda-navigator.desktop cp到該使用者的目錄下就可以使用了。
$ su cltai
$ source /home/steventsai/.bashrc
$ cp /home/steventsai/Desktop/anaconda-navigator.desktop ~/.local/share/applications/
就可以在cltai下使用anaconda了。

 

中文輸入法:https://fpjs.fun/ubuntu/desktop/chewing/ 
因為這個相對不重要,最後再安裝即可。英文介面操作比較快和順。

# apt-get install ibus ibus-chewing

Reading package lists... Done
Building dependency tree
Reading state information... Done

Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...

登出再登入,使用圖形介面:
Settings >>> Region & Languages >>>Input Sources >> + >>> ... >>> Other >>> Chiese (Chewing)

更改顯示設定,再登出登入,就生效了。

arrow
arrow

    貓熊麗麗 發表在 痞客邦 留言(0) 人氣()