myservice:edserver
差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版前次修改 | |||
| myservice:edserver [2025/05/11 06:13] – [安裝 net tool] eddie | myservice:edserver [2025/11/25 05:32] (目前版本) – 移除 eddie | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ====== Install Ubuntu 24.04 ====== | ||
| - | ==== Set First User ==== | ||
| - | - username/ | ||
| - | - uid=1000, that same as OMVServer | ||
| - | ==== Set IP ==== | ||
| - | - ens192: | ||
| - | - set LAN to static < | ||
| - | network: | ||
| - | version: 2 | ||
| - | ethernets: | ||
| - | ens192: | ||
| - | dhcp4: true | ||
| - | ens36: | ||
| - | dhcp4: true | ||
| - | </ | ||
| - | network: | ||
| - | version: 2 | ||
| - | ethernets: | ||
| - | ens192: | ||
| - | # | ||
| - | addresses: | ||
| - | [192.168.123.11/ | ||
| - | routes: | ||
| - | - to: default | ||
| - | via: 192.168.123.249 | ||
| - | # | ||
| - | nameservers: | ||
| - | search: [local] | ||
| - | addresses: | ||
| - | # | ||
| - | ens36: | ||
| - | dhcp4: true | ||
| - | # | ||
| - | </ | ||
| - | - apply < | ||
| - | ==== 設定時區 ==== | ||
| - | * Set Timezone to Asia/Taipei < | ||
| - | ==== PPPoE ==== | ||
| - | * Set PPPoE (不要 apt upgrade, 不然pppoe 會有問題? | ||
| - | - PPPoE package installation < | ||
| - | - Set up PPPoE connection < | ||
| - | - 把 LAN IP gateway 取消, only ppp 對外 < | ||
| - | network: | ||
| - | version: 2 | ||
| - | ethernets: | ||
| - | ens192: | ||
| - | # link-local: | ||
| - | # [ipv4] | ||
| - | addresses: | ||
| - | [192.168.123.11/ | ||
| - | # nameservers: | ||
| - | # addresses: | ||
| - | # [192.168.123.249] | ||
| - | # search: | ||
| - | # [] | ||
| - | # routes: | ||
| - | # - to: " | ||
| - | # via: " | ||
| - | ens36: | ||
| - | # link-local: | ||
| - | # [ipv4] | ||
| - | addresses: | ||
| - | [192.168.2.11/ | ||
| - | #dhcp4: true | ||
| - | </ | ||
| - | ==== 安裝 net tool ==== | ||
| - | * Install net-tools (for ifconfig, router...) < | ||
| - | ==== Installing Crontab ==== | ||
| - | ref: https:// | ||
| - | < | ||
| - | Problem: Installing Crontab on Ubuntu | ||
| - | Ubuntu users often need to schedule tasks to run automatically at set times. Crontab is a tool for this purpose, but setting it up can be hard for new users. Users may have trouble with the installation process and understanding how to set up crontab on their Ubuntu systems. | ||
| - | |||
| - | Installing Crontab on Ubuntu | ||
| - | Using the Command Line to Install Cron | ||
| - | To install cron on Ubuntu using the command line, follow these steps: | ||
| - | |||
| - | Open the terminal on your Ubuntu system. | ||
| - | |||
| - | Update the package list: | ||
| - | |||
| - | sudo apt update | ||
| - | |||
| - | Install cron: | ||
| - | |||
| - | sudo apt install cron | ||
| - | |||
| - | Start the cron service: | ||
| - | |||
| - | sudo systemctl start cron | ||
| - | |||
| - | Enable cron to start on system boot: | ||
| - | |||
| - | sudo systemctl enable cron | ||
| - | |||
| - | To verify the installation: | ||
| - | |||
| - | Check the cron service status: | ||
| - | |||
| - | sudo systemctl status cron | ||
| - | |||
| - | This shows if cron is active and running. | ||
| - | |||
| - | Confirm the crontab version: | ||
| - | |||
| - | crontab -V | ||
| - | |||
| - | This displays the installed crontab version. | ||
| - | |||
| - | List current cron jobs: | ||
| - | |||
| - | crontab -l | ||
| - | |||
| - | This shows existing cron jobs for the current user. | ||
| - | |||
| - | Setting Up Your First Cron Job in Ubuntu | ||
| - | Understanding Cron Job Syntax | ||
| - | Cron job syntax uses a schedule format with five time fields: | ||
| - | |||
| - | * * * * * command_to_execute | ||
| - | |||
| - | These fields represent: | ||
| - | |||
| - | Minute (0-59) | ||
| - | Hour (0-23) | ||
| - | Day of the month (1-31) | ||
| - | Month (1-12) | ||
| - | Day of the week (0-7, where 0 and 7 represent Sunday) | ||
| - | An asterisk () in any field means " | ||
| - | |||
| - | You can use numbers, ranges (1-5), lists (1,3,5), and step values (*/2 for every two units) in these fields. | ||
| - | |||
| - | Creating a Crontab File | ||
| - | To create or edit your crontab file: | ||
| - | |||
| - | Open the crontab editor: | ||
| - | |||
| - | crontab -e | ||
| - | |||
| - | If it's your first time, you'll need to choose an editor (e.g., nano). | ||
| - | |||
| - | Add new cron jobs, one per line. For example: | ||
| - | |||
| - | 0 2 * * * / | ||
| - | |||
| - | This runs a backup script every day at 2:00 AM. | ||
| - | |||
| - | Save the file and exit the editor. In nano, press Ctrl+X, then Y, then Enter. | ||
| - | |||
| - | After saving, the system installs the new crontab. You can view your cron jobs with the crontab -l command. | ||
| - | |||
| - | Managing Cron Jobs in Ubuntu | ||
| - | Listing Existing Cron Jobs | ||
| - | To view your current cron jobs, use the following command in the terminal: | ||
| - | |||
| - | crontab -l | ||
| - | |||
| - | This command shows all the cron jobs for the current user. To view cron jobs for another user (requires root privileges), | ||
| - | |||
| - | sudo crontab -u username -l | ||
| - | |||
| - | Replace " | ||
| - | |||
| - | Editing Cron Jobs | ||
| - | To change existing cron jobs: | ||
| - | |||
| - | Open the crontab file: | ||
| - | |||
| - | crontab -e | ||
| - | |||
| - | Go to the job you want to change. | ||
| - | |||
| - | Edit the job as needed. You can change the schedule or the command to run. | ||
| - | |||
| - | Save the changes and exit the editor. In nano, press Ctrl+X, then Y, then Enter. | ||
| - | |||
| - | The system installs the updated crontab after you save and exit. | ||
| - | |||
| - | Deleting Cron Jobs | ||
| - | To remove specific cron jobs: | ||
| - | |||
| - | Open the crontab file: | ||
| - | |||
| - | crontab -e | ||
| - | |||
| - | Find the job you want to delete. | ||
| - | |||
| - | Remove the entire line for that job. | ||
| - | |||
| - | Save and exit the editor. | ||
| - | |||
| - | To clear all cron jobs for the current user: | ||
| - | |||
| - | crontab -r | ||
| - | |||
| - | This command removes the entire crontab file. Use it carefully. | ||
| - | |||
| - | To remove all cron jobs for a specific user (requires root privileges): | ||
| - | |||
| - | sudo crontab -r -u username | ||
| - | |||
| - | Replace " | ||
| - | |||
| - | It's a good idea to back up your crontab before making big changes. You can do this by running: | ||
| - | |||
| - | crontab -l > crontab_backup | ||
| - | |||
| - | This saves your current crontab to a file named " | ||
| - | |||
| - | Advanced Cron Usage in Ubuntu | ||
| - | System-Wide Crontab Files | ||
| - | System-wide crontab files in Ubuntu are in the / | ||
| - | |||
| - | To edit system-wide cron jobs: | ||
| - | |||
| - | Open the terminal. | ||
| - | |||
| - | Use a text editor with root privileges to open or create a file in / | ||
| - | |||
| - | sudo nano / | ||
| - | |||
| - | Add cron jobs using the cron syntax, including the user to run the job: | ||
| - | |||
| - | 0 4 * * * root / | ||
| - | |||
| - | Save the file and exit the editor. | ||
| - | |||
| - | The system reads and applies these cron jobs without restarting the cron service. | ||
| - | |||
| - | Redirecting Cron Job Output | ||
| - | Cron sends job output to the user's email by default. You can redirect this output to log files or other email addresses. | ||
| - | |||
| - | To log cron job results: | ||
| - | |||
| - | Redirect output and error to a file: | ||
| - | |||
| - | 0 5 * * * / | ||
| - | |||
| - | This runs the script daily at 5 AM and logs output and errors to logfile.log. | ||
| - | |||
| - | Add output to an existing log file: | ||
| - | |||
| - | 0 6 * * * / | ||
| - | |||
| - | This adds the output to logfile.log instead of overwriting it. | ||
| - | |||
| - | To send output to a specific email: | ||
| - | |||
| - | Use the MAILTO variable at the top of your crontab file: | ||
| - | |||
| - | MAILTO=" | ||
| - | 0 7 * * * / | ||
| - | |||
| - | This sends the script' | ||
| - | |||
| - | For individual job emails, use the mail command: | ||
| - | |||
| - | 0 8 * * * / | ||
| - | |||
| - | This sends the output of the job to the email address with a custom subject line. | ||
| - | |||
| - | Troubleshooting Cron Jobs in Ubuntu | ||
| - | Checking Cron Logs | ||
| - | To find and read cron log files in Ubuntu: | ||
| - | |||
| - | Open the terminal. | ||
| - | |||
| - | View the main system log: | ||
| - | |||
| - | sudo grep CRON / | ||
| - | |||
| - | This shows cron-related entries in the system log. | ||
| - | |||
| - | For real-time monitoring, use: | ||
| - | |||
| - | sudo tail -f / | ||
| - | |||
| - | This displays new cron log entries as they occur. | ||
| - | |||
| - | To identify issues with cron job execution: | ||
| - | |||
| - | Look for error messages in the log output. | ||
| - | Check the timestamps to see if jobs run at scheduled times. | ||
| - | Look for " | ||
| - | Common Cron Job Errors and Solutions | ||
| - | Addressing permission problems: | ||
| - | |||
| - | Make sure the user running the cron job has the right permissions for the task. | ||
| - | For scripts, check file permissions: | ||
| - | chmod +x / | ||
| - | |||
| - | Use sudo in the crontab if the job needs root privileges: | ||
| - | 0 * * * * sudo / | ||
| - | |||
| - | Resolving path-related issues: | ||
| - | |||
| - | Use full paths for commands and scripts in cron jobs. | ||
| - | Set the PATH variable in your crontab: | ||
| - | PATH=/ | ||
| - | |||
| - | Source the user's profile in the cron job: | ||
| - | 0 * * * * . $HOME/ | ||
| - | |||
| - | Alternative Task Scheduling Methods in Ubuntu | ||
| - | Using Systemd Timers | ||
| - | Systemd timers are an alternative to cron jobs in Ubuntu. They are part of the systemd init system and offer some benefits: | ||
| - | |||
| - | Systemd timers can start services, not just run commands. | ||
| - | They provide more timing control. | ||
| - | Systemd logs timer events, making troubleshooting easier. | ||
| - | To create a systemd timer: | ||
| - | |||
| - | Create a service file (e.g., myjob.service) in / | ||
| - | |||
| - | [Unit] | ||
| - | Description=My Job | ||
| - | |||
| - | [Service] | ||
| - | ExecStart=/ | ||
| - | |||
| - | Create a timer file (e.g., myjob.timer) in the same directory: | ||
| - | |||
| - | [Unit] | ||
| - | Description=Run My Job | ||
| - | |||
| - | [Timer] | ||
| - | OnCalendar=*-*-* 02:00:00 | ||
| - | Persistent=true | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=timers.target | ||
| - | |||
| - | Enable and start the timer: | ||
| - | |||
| - | sudo systemctl enable myjob.timer | ||
| - | sudo systemctl start myjob.timer | ||
| - | |||
| - | Compared to cron jobs, systemd timers offer better system integration and more detailed logging. However, they can be harder to set up. | ||
| - | |||
| - | At Command for One-Time Task Scheduling | ||
| - | The ' | ||
| - | |||
| - | Schedule a task: | ||
| - | |||
| - | at 2:00 PM | ||
| - | |||
| - | This opens a prompt where you can enter commands. | ||
| - | |||
| - | Enter the command to run, then press Ctrl+D to save. | ||
| - | |||
| - | View scheduled tasks: | ||
| - | |||
| - | atq | ||
| - | |||
| - | Remove a scheduled task: | ||
| - | |||
| - | atrm [job number] | ||
| - | |||
| - | The ' | ||
| - | |||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | |||
| - | Best Practices for Using Cron in Ubuntu | ||
| - | When using cron in Ubuntu, following these practices helps keep your system secure and running well. Here are some key points: | ||
| - | |||
| - | Security: | ||
| - | |||
| - | Limit access to crontab files. Only give users the ability to create cron jobs if needed. | ||
| - | |||
| - | Use specific user accounts for cron jobs instead of running all as root. | ||
| - | |||
| - | Don't put passwords directly in cron commands. Use environment variables or secure files. | ||
| - | |||
| - | Check your crontab files often to remove old jobs. | ||
| - | |||
| - | Improving cron job performance: | ||
| - | |||
| - | Schedule big jobs during quiet hours to reduce system load. | ||
| - | |||
| - | Put multiple small tasks into one script to lower system work. | ||
| - | |||
| - | Use anacron for jobs that don't need to run at exact times, especially on systems that aren't always on. | ||
| - | |||
| - | Set nice values for CPU-heavy cron jobs to avoid affecting system performance. | ||
| - | |||
| - | Maintaining crontab files: | ||
| - | |||
| - | Check your crontab files monthly to remove or update old jobs. | ||
| - | |||
| - | Write the purpose of each cron job in comments in the crontab file. | ||
| - | |||
| - | Use version control or backups for your crontab files to track changes and fix mistakes. | ||
| - | |||
| - | Test new cron jobs well before adding them to main systems. | ||
| - | |||
| - | Check the output of your cron jobs often to find and fix issues quickly. | ||
| - | |||
| - | By following these practices, you can keep a secure, efficient, and easy-to-manage cron setup on your Ubuntu system. | ||
| - | </ | ||
| - | ====== Mount Raid5 NFS ====== | ||
| - | ==== Mount NFS ==== | ||
| - | - Install NFS common < | ||
| - | - List NFS Server Folder < | ||
| - | - Mount NFS < | ||
| - | - Check NFS < | ||
| - | ==== Auto Mount NFS ==== | ||
| - | - Set NFS auto mount when system resrt < | ||
| - | # /etc/fstab: static file system information. | ||
| - | # | ||
| - | # Use ' | ||
| - | # device; this may be used with UUID= as a more robust way to name devices | ||
| - | # that works even if disks are added and removed. See fstab(5). | ||
| - | # | ||
| - | # <file system> <mount point> | ||
| - | # / was on /dev/sda2 during curtin installation | ||
| - | / | ||
| - | / | ||
| - | 192.168.123.12:/ | ||
| - | </ | ||
| - | |||
| - | ====== Install Apache + PHP ====== | ||
| - | * ref: https:// | ||
| - | ==== Update and Upgrade the system ==== | ||
| - | - Update and Upgrade the system. < | ||
| - | $ apt update && apt upgrade -y | ||
| - | (但怕 upgrade 後 pppoe 會有問題, | ||
| - | $ apt update | ||
| - | </ | ||
| - | |||
| - | ==== Install Apache2 and PHP Modules ==== | ||
| - | - install Apache2 < | ||
| - | - Install PHP and other Dependencies < | ||
| - | $ apt install php php-common libapache2-mod-php php-bz2 php-gd php-mysql \ | ||
| - | php-curl php-mbstring php-imagick php-zip php-common php-curl php-xml \ | ||
| - | php-json php-bcmath php-xml php-intl php-gmp zip unzip wget -y</ | ||
| - | - Enable required Apache modules < | ||
| - | - Now, Restart, Enable and Check Apache is Running Properly. < | ||
| - | $ systemctl restart apache2 | ||
| - | $ systemctl enable apache2</ | ||
| - | - Apache service should be in running state. < | ||
| - | apache2.service - The Apache HTTP Server | ||
| - | | ||
| - | | ||
| - | | ||
| - | Docs: https:// | ||
| - | Main PID: 16319 (apache2) | ||
| - | Tasks: 6 (limit: 2269) | ||
| - | | ||
| - | CPU: 97ms | ||
| - | | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | - Check modules are loaded on Apache (Output omitted) < | ||
| - | Loaded Modules: | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | ............ | ||
| - | </ | ||
| - | |||
| - | ==== 解除 PHP 上傳大檔案限制 ==== | ||
| - | * ref: https:// | ||
| - | - 編輯 PHP 的 php.ini 設定檔,放寬檔案上傳大小相關的設定:< | ||
| - | ; 上傳檔案大小上限(單一檔案大小) | ||
| - | upload_max_filesize = 2G | ||
| - | |||
| - | ; POST 大小上限(所有檔案大小加總) | ||
| - | post_max_size = 2G | ||
| - | |||
| - | ; 記憶體用量上限 | ||
| - | memory_limit = 2G | ||
| - | </ | ||
| - | - 上傳大型檔案通常都會需要比較久的時間,而 PHP 預設的設定不允許 PHP 指令稿執行太久,如果這部分沒有調整的話,可能會造成檔案上傳到一半,程式就被系統終止了,這樣也是傳不上去,所以要再調整 PHP 指令稿執行時間的設定值,讓 PHP 指令稿可以執行比較久一點,讓檔案可以傳的完。< | ||
| - | ; PHP 指令稿執行時間上限(秒) | ||
| - | max_execution_time = 600 | ||
| - | |||
| - | ; PHP 指令稿解析輸入資料時間上限(秒) | ||
| - | max_input_time = 600 | ||
| - | </ | ||
| - | - 若擔心網路不穩造成傳大檔案時容易斷線的話,可以嘗試將 socket 等待逾時的設定調大一點:< | ||
| - | ; socket 等待逾時(秒) | ||
| - | default_socket_timeout = 600 | ||
| - | </ | ||
| - | |||
| - | ====== Install Database(MariaDB) ====== | ||
| - | ==== Install MariaDB Server ==== | ||
| - | - Install mariadb-server package < | ||
| - | - Now, restart and enable MariaDB service. < | ||
| - | $ systemctl restart mariadb | ||
| - | $ systemctl enable mariadb | ||
| - | </ | ||
| - | - check MariaDB is Running.< | ||
| - | ● mariadb.service - MariaDB 10.11.7 database server | ||
| - | | ||
| - | | ||
| - | | ||
| - | Docs: man: | ||
| - | | ||
| - | Main PID: 17589 (mariadbd) | ||
| - | | ||
| - | Tasks: 12 (limit: 14975) | ||
| - | | ||
| - | CPU: 573ms | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | ==== Configure MariaDB Server ==== | ||
| - | * [MariaDB 允許外部連線的設定] \\ 不管是 MariaDB 還是 Mysql ,安裝好後都是只允許從 localhost連進資料庫,如果要從遠端連線的話需要修改一些設定和權限。 | ||
| - | - 修改設定檔 \\ MariaDB的設定檔預設是 < | ||
| - | - 給予使用者外部連線的權限 \\ 先連入 mariaDB < | ||
| - | |||
| - | ==== 將 Mysql 移至 Fileserver ==== | ||
| - | * 以下請以 root 權限下執行 | ||
| - | - 建立新的mysql資料夾< | ||
| - | $ cd / | ||
| - | $ mkdir MySQL_10.11.11-MariaDB | ||
| - | </ | ||
| - | - 更改權限< | ||
| - | $ chown mysql:mysql MySQL_10.11.11-MariaDB | ||
| - | </ | ||
| - | - 關閉 mysql 服務< | ||
| - | $ systemctl stop mysqld | ||
| - | </ | ||
| - | - 更改 mysql 位置< | ||
| - | $ cd /var/lib/ | ||
| - | $ mv mysql mysql_backup | ||
| - | $ ln -s / | ||
| - | $ mv mysql_backup/ | ||
| - | $ rm -rf mysql_backup/ | ||
| - | </ | ||
| - | - 啟動 mysql< | ||
| - | $ systemctl start mysqld | ||
| - | </ | ||
| - | - 測試 mysql< | ||
| - | $ systemctl status mysqld | ||
| - | </ | ||
| - | |||
| - | ====== Install NextCloud ====== | ||
| - | https:// | ||
| - | ==== Create Directory for Nextcloud ==== | ||
| - | * from /usr/local create a Symbolic link for Nextcloud< | ||
| - | $ cd /usr/local/ | ||
| - | $ ln -s / | ||
| - | </ | ||
| - | |||
| - | ==== Download Nextcloud ==== | ||
| - | - Download Nextcloud with latest version< | ||
| - | $ cd / | ||
| - | $ wget https:// | ||
| - | </ | ||
| - | - Unzip < | ||
| - | - Remove the zip file, which is not necessary now. < | ||
| - | - Change the ownership of the nextcloud directory to the HTTP user. < | ||
| - | |||
| - | ==== Set Apache Virtual Host ==== | ||
| - | - Confirm Apache is installed < | ||
| - | - Create a directory structure.\\ Create a directory structure for your websites. In this example, we’ll set up directories for cloud.lang.idv.tw< | ||
| - | $ mkdir -p / | ||
| - | </ | ||
| - | - Create Virtual Configuration\\ Create a new virtual host configuration file for cloud.lang.idv.tw:< | ||
| - | $ vi / | ||
| - | </ | ||
| - | < | ||
| - | ServerAdmin eddie@lang.idv.tw | ||
| - | ServerName cloud.lang.idv.tw | ||
| - | # | ||
| - | DocumentRoot / | ||
| - | |||
| - | < | ||
| - | Options Indexes FollowSymLinks | ||
| - | AllowOverride All | ||
| - | Require all granted | ||
| - | </ | ||
| - | |||
| - | ErrorLog ${APACHE_LOG_DIR}/ | ||
| - | CustomLog ${APACHE_LOG_DIR}/ | ||
| - | </ | ||
| - | </ | ||
| - | - Enable the Virtual Host\\ Enable the new virtual host with the following command:< | ||
| - | $ a2ensite cloud.lang.idv.tw.conf</ | ||
| - | - Test the Configuration\\ Check the configuration for syntax errors:< | ||
| - | $ apache2ctl configtest</ | ||
| - | - Restart\\ Restart Apache to apply the changes:< | ||
| - | $ systemctl restart apache2</ | ||
| - | - **訪問 FollowSymLinks 須要把目錄加上 執行權限, | ||
| - | $ chmod o+x / | ||
| - | $ chmod o+x / | ||
| - | </ | ||
| - | |||
| - | ==== Create Database ==== | ||
| - | - Create Database and User for Nextcloud and Provide User Permissions. < | ||
| - | CREATE USER ' | ||
| - | CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; | ||
| - | GRANT ALL PRIVILEGES ON nextcloud.* TO ' | ||
| - | FLUSH PRIVILEGES; | ||
| - | quit; | ||
| - | </ | ||
| - | |||
| - | ==== Install Nextcloud ==== | ||
| - | - Install Nextcloud\\You can install Nextcloud via the web GUI or command line, and you can choose your preferred method.\\ | ||
| - | http:// | ||
| - | $ cd / | ||
| - | $ sudo -u www-data php occ maintenance: | ||
| - | " | ||
| - | ' | ||
| - | - Add access domain\\ Nextcloud allows access only from localhost, it could through error “Access through untrusted domain”. we need to allow accessing Nextcloud by using ip or domain name.< | ||
| - | ' | ||
| - | array ( | ||
| - | 0 => ' | ||
| - | 1 => ' | ||
| - | ), | ||
| - | ..... | ||
| - | :x | ||
| - | </ | ||
| - | ==== Nextcloud的一些錯誤提示 ==== | ||
| - | ref: https:// | ||
| - | ref: https:// | ||
| - | - PHP 內存限制低於建議值 512MB\\ 您可以通過以下步驟增加PHP內存限制:\\ 打開php.ini文件 在終端中輸入以下命令打開php.ini文件:< | ||
| - | - other< | ||
| - | ; The OPcache shared memory storage size. | ||
| - | opcache.memory_consumption=512 | ||
| - | |||
| - | ; The amount of memory for interned strings in Mbytes. | ||
| - | opcache.interned_strings_buffer=32 | ||
| - | </ | ||
| - | - 重啟Apache服務器\\ 在終端中輸入以下命令以重啟Apache服務器:< | ||
| - | |||
| - | ====== Install DokuWiki ====== | ||
| - | |||
| - | ==== Update Your System ==== | ||
| - | * Open your terminal and run:< | ||
| - | $ sudo apt update && sudo apt upgrade -y</ | ||
| - | |||
| - | ==== Install Required Packages ==== | ||
| - | * Install Apache, PHP, and other necessary packages:\\ maybe these have installed, but you also can install again< | ||
| - | $ sudo apt install apache2 php php-xml libapache2-mod-php unzip -y</ | ||
| - | |||
| - | ==== Download DokuWiki ==== | ||
| - | * Navigate to the web directory and download the latest DokuWiki version:< | ||
| - | $ cd / | ||
| - | $ sudo wget https:// | ||
| - | </ | ||
| - | |||
| - | ==== Extract DokuWiki ==== | ||
| - | * Extract the downloaded file and rename the directory:< | ||
| - | $ sudo tar xvf dokuwiki-stable.tgz | ||
| - | $ sudo ln -s dokuwiki-*/ dokuwiki | ||
| - | </ | ||
| - | |||
| - | ==== Set Permissions ==== | ||
| - | * Adjust permissions for the DokuWiki directory:< | ||
| - | $ sudo chown -R www-data: | ||
| - | $ sudo chmod -R 755 / | ||
| - | </ | ||
| - | |||
| - | ==== Configure Apache ==== | ||
| - | * Create a new Apache configuration file:< | ||
| - | $ sudo nano / | ||
| - | * Add the following content:< | ||
| - | < | ||
| - | ServerAdmin eddie@lang.idv.tw | ||
| - | ServerName wiki.lang.idv.tw | ||
| - | # | ||
| - | DocumentRoot / | ||
| - | |||
| - | < | ||
| - | Options Indexes FollowSymLinks | ||
| - | AllowOverride All | ||
| - | Require all granted | ||
| - | </ | ||
| - | |||
| - | ErrorLog ${APACHE_LOG_DIR}/ | ||
| - | CustomLog ${APACHE_LOG_DIR}/ | ||
| - | </ | ||
| - | </ | ||
| - | * Save and exit. | ||
| - | |||
| - | ==== Enable the Site and Rewrite Module ==== | ||
| - | * Enable the new site and the rewrite module:< | ||
| - | $ sudo a2ensite wiki.lang.idv.tw.conf | ||
| - | $ sudo a2enmod rewrite | ||
| - | $ sudo systemctl restart apache2 | ||
| - | </ | ||
| - | |||
| - | ==== Complete Installation in Browser ==== | ||
| - | * Open your browser and navigate to < | ||
| - | * Follow the on-screen instructions to complete the setup. | ||
| - | |||
| - | ==== Secure Your Installation ==== | ||
| - | * After installation, | ||
| - | $ sudo rm / | ||
| - | * DokuWiki is now installed and ready to use on your Ubuntu 24.04 LTS system. | ||
| - | |||
| - | ====== Install Wordpress for Pingtek ====== | ||
| - | ==== Download and unzip the WordPress ==== | ||
| - | - Download Nextcloud with latest version< | ||
| - | $ cd / | ||
| - | $ wget https:// | ||
| - | </ | ||
| - | - Rename latest.tar.gz to wordpress-6.8.1.tar.gz\\ please reference https:// | ||
| - | $ mv latest.tar.gz wordpress-6.8.1.tar.gz | ||
| - | </ | ||
| - | - extract the package\\ The WordPress package will extract into a folder called wordpress in the same directory< | ||
| - | $ tar -xzvf wordpress-6.8.1.tar.gz | ||
| - | </ | ||
| - | - Rename directory to wordpress_Pingtek< | ||
| - | $ mv wordpress wordpress_Pingtek | ||
| - | </ | ||
| - | - Change the ownership of the wordpress_Pingtek directory to the HTTP user< | ||
| - | $ chown -R www-data: | ||
| - | </ | ||
| - | |||
| - | ==== Create Database ==== | ||
| - | - Create Database and User for Wordpress_Pingtek and Provide User Permissions. < | ||
| - | CREATE USER ' | ||
| - | CREATE DATABASE wordpress_pingtek CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; | ||
| - | GRANT ALL PRIVILEGES ON wordpress_pingtek.* TO ' | ||
| - | FLUSH PRIVILEGES; | ||
| - | quit; | ||
| - | </ | ||
| - | |||
| - | |||
| - | ==== Set Apache Virtual Host ==== | ||
| - | - Confirm Apache is installed < | ||
| - | - Create a directory structure.\\ Create a directory structure for your websites. In this example, we’ll set up directories for pingtek.com.tw< | ||
| - | $ mkdir -p / | ||
| - | </ | ||
| - | - Create Virtual Configuration\\ Create a new virtual host configuration file for pingtek.com.tw:< | ||
| - | $ vi / | ||
| - | </ | ||
| - | < | ||
| - | ServerAdmin eddie@lang.idv.tw | ||
| - | ServerName pingtek.com.tw | ||
| - | ServerAlias www.pingtek.com.tw | ||
| - | DocumentRoot / | ||
| - | |||
| - | < | ||
| - | Options Indexes FollowSymLinks | ||
| - | AllowOverride All | ||
| - | Require all granted | ||
| - | </ | ||
| - | |||
| - | ErrorLog ${APACHE_LOG_DIR}/ | ||
| - | CustomLog ${APACHE_LOG_DIR}/ | ||
| - | </ | ||
| - | </ | ||
| - | - Enable the Virtual Host\\ Enable the new virtual host with the following command:< | ||
| - | $ a2ensite pingtek.com.tw.conf</ | ||
| - | - Test the Configuration\\ Check the configuration for syntax errors:< | ||
| - | $ apache2ctl configtest</ | ||
| - | - Restart\\ Restart Apache to apply the changes:< | ||
| - | $ systemctl restart apache2</ | ||
| - | - **訪問 FollowSymLinks 須要把目錄加上 執行權限, | ||
| - | $ chmod o+x / | ||
| - | $ chmod o+x / | ||
| - | </ | ||
| - | |||
| - | ==== Setup Wordpress ==== | ||
| - | - Setup Wordpress by Web GUI< | ||
| - | $ http:// | ||
| - | </ | ||
| - | - 依畫面完成設定 | ||
| - | {{ : | ||
| - | {{ : | ||
| - | |||
| - | ==== 還原備份檔 ==== | ||
| - | * 原以使用 " | ||
| - | - 安裝外掛 " | ||
| - | - From " | ||
| - | - 還原後若忘了管理者密碼, | ||
| - | - 登入 mysql< | ||
| - | $ mysql -u root -p | ||
| - | or | ||
| - | # used root user direct into mysql | ||
| - | $ mysql | ||
| - | </ | ||
| - | - check the WordPress database\\ that can used below command show all database and check the WordPress database < | ||
| - | show databases; | ||
| - | </ | ||
| - | +--------------------+ | ||
| - | | Database | ||
| - | +--------------------+ | ||
| - | | information_schema | | ||
| - | | mysql | | ||
| - | | nextcloud | ||
| - | | performance_schema | | ||
| - | | sys | | ||
| - | | wordpress_pingtek | ||
| - | +--------------------+ | ||
| - | 6 rows in set (0.007 sec) | ||
| - | </ | ||
| - | - select WordPress database< | ||
| - | use wordpress_pingtek; | ||
| - | </ | ||
| - | - you’re looking for a table name with “users” at the end< | ||
| - | show tables; | ||
| - | </ | ||
| - | +-------------------------------------------------+ | ||
| - | | Tables_in_wordpress_pingtek | ||
| - | +-------------------------------------------------+ | ||
| - | | wp_commentmeta | ||
| - | | wp_comments | ||
| - | | wp_formmaker | ||
| - | | . | | ||
| - | | . | | ||
| - | | . | | ||
| - | | wp_users | ||
| - | | . | | ||
| - | | . | | ||
| - | | . | | ||
| - | +-------------------------------------------------+ | ||
| - | 50 rows in set (0.001 sec) | ||
| - | </ | ||
| - | - select USER and check whick user will be reset< | ||
| - | SELECT ID, user_login, user_pass FROM wp_users; | ||
| - | </ | ||
| - | MariaDB [wordpress_pingtek]> | ||
| - | +----+------------+-----------------------------------------------------------------+ | ||
| - | | ID | user_login | user_pass | ||
| - | +----+------------+-----------------------------------------------------------------+ | ||
| - | | 1 | admin | $w******************************1K | ||
| - | | 2 | e***e | $w******************************JW | ||
| - | | 3 | j**f | $P******************************g1 | ||
| - | | 4 | w***e | $P******************************v/ | ||
| - | +----+------------+-----------------------------------------------------------------+ | ||
| - | 4 rows in set (0.001 sec) | ||
| - | </ | ||
| - | - actually changes the password(this sample will change admin user< | ||
| - | UPDATE wp_users SET user_pass = MD5(' | ||
| - | </ | ||
| - | - confirm that it was changed< | ||
| - | SELECT ID, user_login, user_pass FROM wp_users; | ||
| - | </ | ||
| - | - exit mysql client< | ||
| - | - remove " | ||
| - | - 安裝另一個備份程式" | ||
| - | - That all | ||
| - | |||
| - | set php\\ https:// | ||
myservice/edserver.1746944025.txt.gz · 上一次變更: 由 eddie
