Raspberry Pi 3 B+設定順序


  1. 下載 Raspberry Pi OS imager https://www.raspberrypi.org/software/
  2. 安裝並執行
  3. 設定好要的OS後,進行安裝
  4. 寫完後將SD卡退出,這時插回SD卡,於 boot 碟產生一個名為 ssh 的空檔案 (可用新增文字文件再改名),如此沒有鍵盤,也可以用ssh登入
  5. 將SD卡插入Raspberry Pi中,接卡網路線和HDMI及電源,啟動
  6. 待啟動完後,使用Angry IP Scanner等工具掃出其IP,使用Putty登入 (pi / raspberry)
  7. 更新:
    1. sudo apt-get update
    2. sudo apt-get -y upgrade
    3. sudo apt-get -y dist-upgrade
    4. sudo rpi-update (更新Firmware)
    5. sudo apt -y autoremove
    6. sudo reboot
  8. 其它package
    1. nslookup: sudo apt-get install -y dnsutils
  9. VNC (https://www.raspberrypi.org/documentation/remote-access/vnc/)
  10. 中文字型
    1. sudo apt-get install fonts-arphic* (文鼎全部)
    2. sudo apt-get install fonts-moe-standard-kai (教育部標準楷書)
    3. sudo apt-get install fonts-cwtex-yen (cwTex圓體)
  11. 輸入法
    1. sudo apt-get install -y fcitx
    2. sudo apt-get install -y fcitx-chewing (注音)
    3. sudo apt-get install -y fcitx-table-array30 fcitx-table-array30-big (行列30)
    4. sudo apt-get install -y fcitx-table-boshiamy (嘸蝦米) 
    5. sudo im-config (設定)
  12. 日文字型、輸入法
    1. sudo apt-get install -y fonts-vlgothic jfbterm fcitx-anthy
  13. PDF reader / editor
    1. sudo apt-get install -y okular
  14. System Monitor (Monitorix)
    1. wget https://www.monitorix.org/monitorix_3.10.1-izzy1_all.deb
      1. 請注意上面的網址會變更
    2. sudo dpkg -i monitorix_3.10.1-izzy1_all.deb (會發生錯誤不用管它,下一行修復)
    3. sudo apt-get -yf install
    4. 修改 /etc/monitorix/monitorix.conf
      1. sudo vi /etc/monitorix/monitorix.conf
        1. raspberrypi     = y
    5. sudo service monitorix restart
  15. Disable ipv6
    1. sudo vi /etc/sysctl.conf
      1. net.ipv6.conf.all.disable_ipv6 = 1
      2. net.ipv6.conf.default.disable_ipv6 = 1
      3. net.ipv6.conf.lo.disable_ipv6 = 1
      4. net.ipv6.conf.eth0.disable_ipv6 = 1
      5. net.ipv6.conf.wlan0.disable_ipv6 = 1
    2. sudo sysctl -p
  16. Static ip address (for wireless wlan0)
    1. sudo vi /etc/dhcpcd.conf
      1. interface wlan0
      2. static ip_address=192.168.1.201/24
      3. static routers=192.168.1.1
      4. static domain_name_servers=168.95.192.1 8.8.8.8 8.8.4.4
  17. Static ip address (for eth0)
    1. sudo vi /etc/dhcpcd.conf
      1. interface eth0
      2. static ip_address=192.168.1.3/24
      3. static routers=192.168.1.1
  18. Disable WiFi and Bluetooth
    1. sudo rfkill block wifi
    2. sudo rfkill block bluetooth
  19. 整體設定
    1. sudo raspi-config
  20. sudo rerboot
  21. Cacti 1.1.38 or later (Monitor; 內建的Cacti版本很舊) 
    1. sudo apt-get install -y apache2
    2. sudo rm /var/www/html/index.html
    3. sudo apt-get install -y mariadb-server mariadb-client mariadb-common
    4. sudo apt-get install -y php7.0 php7.0-snmp php7.0-xml php7.0-mbstring php7.0-json php7.0-gd php7.0-gmp php7.0-zip php7.0-ldap php7.0-mcrypt php7.0-mysql 
    5. sudo vi /etc/php/7.0/apache2/php.ini
      1. add date.timezone = Asia/Taipei
    6. sudo useradd -r -M cactiuser
    7. cd /usr/share/mysql
    8. sudo mysql  mysql < mysql_test_data_timezone.sql
    9. sudo mysql
      1. mysql> create database cacti;
      2. mysql> grant all on cacti.* to 'cactiuser'@'localhost' identified by 'cactipassword';
      3. mysql> flush privileges;
      4. mysql> exit
    10. sudo mysql mysql -e 'grant select on mysql.time_zone_name to cactiuser@localhost'
    11. sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
      1. max_heap_table_size = 46M
      2. tmp_table_size = 64M
      3. join_buffer_size = 64M
      4. innodb_buffer_pool_size = 227M
      5. innodb_doublewrite = off
      6. innodb_flush_log_at_timeout = 3
      7. innodb_read_io_threads = 32
      8. innodb_write_io_threads = 16
      9. innodb_additional_mem_pool_size = 8M
      10. collation_server = utf8mb4_unicode_ci
    12. wget https://www.cacti.net/downloads/cacti-latest.tar.gz
    13. tar xfz cacti-latest.tar.gz
    14. sudo cp -rf cacti-1.1.38/* /var/www/html/
    15. sudo touch /var/www/html/log/cacti.log
    16. sudo chown -R www-data:www-data /var/www/html/
    17. sudo vi /var/www/html/include/config.php (find and replace)
      1. $database_type     = 'mysql';
      2. $database_default  = 'cacti';
      3. $database_hostname = 'localhost';
      4. $database_username = 'cactiuser';
      5. $database_password = 'cactipassword';
      6. $database_port     = '3306';
      7. $database_ssl      = false;
      8. $url_path = '/';
    18. sudo  mysql -u cactiuser cacti -p < /var/www/html/cacti.sql
    19. sudo apt-get install -y snmp snmpd snmp-mibs-downloader rrdtool
    20. sudo systemctl restart snmpd.service 
    21. sudo systemctl status snmpd.service
    22. sudo apt-get install -y build-essential dos2unix dh-autoreconf help2man libssl-dev libmysql++-dev librrds-perl libsnmp-dev libmariadb-dev libmariadbclient-dev
    23. wget https://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz
    24. tar xfz cacti-spine-latest.tar.gz 
    25. cd cacti-spine-1.1.38/
    26. sudo ./bootstrap
    27. sudo ./configure
    28. sudo make
    29. sudo make install
    30. sudo chown root:root /usr/local/spine/bin/spine
    31. sudo chmod +s /usr/local/spine/bin/spine
    32. sudo vi /usr/local/spine/etc/spine.conf
      1. DB_Host localhost
      2. DB_Database cacti
      3. DB_User cactiuser
      4. DB_Pass cactipassword
      5. DB_Port 3306
    33. http://your_IP/install
    34. login with admin / admin
      1. Console -> Configuration -> Settings -> Paths -> Spine Config File Path -> /usr/local/spine/etc/spine.conf
      2. Console -> Configuration -> Settings -> Poller -> Poller Type -> Spine
    35. sudo crontab -u www-data -e
      1. */5 * * * * /usr/bin/php /var/www/html/poller.php
    36. done

Cacti設完後結果





留言

這個網誌中的熱門文章

Google瀏覽器發生「錯誤107 (net::ERR_SSL_PROTOCOL_ERROR): SSL 通訊協定錯誤」的解決方式

Tomato Port Forwarding / Port Triggering 設定