搜尋此網誌

2018/06/09

Raspberry Pi 3 B+設定順序


  1. 下載 raspbian Image https://www.raspberrypi.org/downloads/raspbian/
  2. 下載 SD Card Formatter https://www.sdcard.org/downloads/formatter_4/
  3. 使用 SD Card Formatter 格式化MicroSD卡
  4. 下載 Etcher https://etcher.io/
  5. 使用 Etcher將raspbian寫入MicroSD卡中 (使用另一套工具Win32DiskImageWriter似乎沒有效果)
  6. 寫完後Etcher會自動將SD卡退出,這時插回SD卡,於 boot 碟產生一個名為 ssh 的空檔案 (可用新增文字文件再改名),如此沒有鍵盤,也可以用ssh登入
  7. 將SD卡插入Raspberry Pi中,接卡網路線和HDMI及電源,啟動
  8. 待啟動完後,使用Angry IP Scanner等工具掃出其IP,使用Putty登入 (pi / raspberry)
  9. 更新:
    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
  10. 其它package
    1. nslookup: sudo apt-get install -y dnsutils
  11. VNC (https://www.raspberrypi.org/documentation/remote-access/vnc/)
  12. 中文字型
    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圓體)
  13. 輸入法
    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 (設定)
  14. 日文字型、輸入法
    1. sudo apt-get install -y fonts-vlgothic jfbterm fcitx-anthy
  15. PDF reader / editor
    1. sudo apt-get install -y okular
  16. 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
  17. 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
  18. 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
  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設完後結果





沒有留言: