整理:
1.只要會用滑鼠點兩下,用shell 在 ubuntu 16.04 x64 桌面版本快速安裝 運動檢錄系統
https://skjhcreator.blogspot.com/2021/03/shell-ubuntu-1604-x64.html
2.紀明村老師運動會競賽檢錄系統更新模組_學生帳號管理模組
https://skjhcreator.blogspot.com/2021/03/blog-post.html
3.二林國小紀明村老師的二林網管 PDO + SQLite 程式寫作工具箱2014.07
https://skjhcreator.blogspot.com/2021/03/pdo-sqlite-201407.html
4.用shell 在CentOS 7 minimal 64位元 安裝 紀明村老師的運動會檢錄系統
https://skjhcreator.blogspot.com/2021/02/shell-centos-7-minimal-64.html
5.紀明村老師的運動檢錄系統程式碼研究心得(一)介接CloudSchool與mysql資料庫
https://skjhcreator.blogspot.com/2021/03/cloudschoolmysql.html
6.紀明村老師運動檢錄系統程式碼研究心得(二)登入login登出logout與使用者認證
https://skjhcreator.blogspot.com/2021/02/loginlogout.html
7.紀明村老師運動檢錄系統程式碼研究心得(三)smarty
https://skjhcreator.blogspot.com/2021/02/smarty.html
1.只要會用滑鼠點兩下,用shell 在 ubuntu 16.04 x64 桌面版本快速安裝 運動檢錄系統
https://skjhcreator.blogspot.com/2021/03/shell-ubuntu-1604-x64.html
2.紀明村老師運動會競賽檢錄系統更新模組_學生帳號管理模組
https://skjhcreator.blogspot.com/2021/03/blog-post.html
3.二林國小紀明村老師的二林網管 PDO + SQLite 程式寫作工具箱2014.07
https://skjhcreator.blogspot.com/2021/03/pdo-sqlite-201407.html
4.用shell 在CentOS 7 minimal 64位元 安裝 紀明村老師的運動會檢錄系統
https://skjhcreator.blogspot.com/2021/02/shell-centos-7-minimal-64.html
5.紀明村老師的運動檢錄系統程式碼研究心得(一)介接CloudSchool與mysql資料庫
https://skjhcreator.blogspot.com/2021/03/cloudschoolmysql.html
6.紀明村老師運動檢錄系統程式碼研究心得(二)登入login登出logout與使用者認證
https://skjhcreator.blogspot.com/2021/02/loginlogout.html
7.紀明村老師運動檢錄系統程式碼研究心得(三)smarty
https://skjhcreator.blogspot.com/2021/02/smarty.html
前篇:用shell 在 ubuntu 16.04 x64 桌面版本快速安裝 運動檢錄系統
由於前篇:用shell 在 ubuntu 16.04 x64 桌面版本快速安裝 運動檢錄系統,發現無法在縣網推廣的第二方案(作業系統:CentOS 7 x64 空間容量:100G 記憶體:1G )使用。因此,開始改寫。由於紀明村老師的Sport1090911.zip放在google 雲端硬碟(第二版Sport1090911.zip),希望shell能夠直接下載後解壓、設定一氣呵成。
20210208完成
感恩二林國小紀明村老師的程式碼分享
感恩永靖國小邱顯錫老師的程式碼分享
一、檔案名稱:Sport109EnvSetup.sh
檔案內容:
#!/bin/bash
yum install -y nano
cd /usr/bin/
ln -s nano pico
export EDITOR="pico"
yum -y update
yum -y install unzip wget
yum -y install epel-release
wget --no-check-certificate https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7*.rpm
yum -y install vim-enhanced nano
echo "alias vi='vim'" >> /etc/profile
echo "set nu" >> /etc/vimrc
source /etc/profile
yum -y install ntp
ntpdate -d time.stdtime.gov.tw
echo '0 * * * * root /usr/sbin/ntpdate time.stdtime.gov.tw > /dev/null 2>&1' >>/etc/crontab
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
systemctl reload sshd
systemctl stop firewalld.service
systemctl disable firewalld.service
yum -y install httpd
sed -i 's/Options Indexes FollowSymLinks/Options FollowSymLinks/g' /etc/httpd/conf/httpd.conf
sed -i 's/DirectoryIndex index.html$/DirectoryIndex index.html index.htm/g' /etc/httpd/conf/httpd.conf
systemctl enable httpd
systemctl start httpd
chown -R apache.apache /var/www
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php70.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php71.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php72.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php74.repo
sed -i '/php73]/,/gpgkey/s/enabled=0/enabled=1/g' /etc/yum.repos.d/remi-php73.repo
yum -y install php php-gd php-mysql php-mcrypt php-intl php-pdo
sed -i 's/^.*date\.timezone.*=.*/date\.timezone = "Asia\/Taipei"/g' /etc/php.ini
sed -i 's/^.*display_errors.*=.*/display_errors = On/g' /etc/php.ini
sed -i 's/^.*max_execution_time.*=.*/max_execution_time = 150/g' /etc/php.ini
sed -i 's/^.*max_file_uploads.*=.*/max_file_uploads = 300/g' /etc/php.ini
sed -i 's/^.*max_input_time.*=.*/max_input_time = 120/g' /etc/php.ini
sed -i 's/^.*max_input_vars.*=.*/max_input_vars = 5000/g' /etc/php.ini
sed -i 's/^.*memory_limit.*=.*/memory_limit = 240M/g' /etc/php.ini
sed -i 's/^.*post_max_size.*=.*/post_max_size = 220M/g' /etc/php.ini
sed -i 's/^.*upload_max_filesize.*=.*/upload_max_filesize = 200M/g' /etc/php.ini
systemctl reload httpd
yum -y install sqlite-devel
echo " Apache 版本:" > ENV.txt
httpd -v >> ENV.txt
echo " PHP 版本:" >> ENV.txt
php -v >> ENV.txt
echo " Sqlite 版本:" >> ENV.txt
sqlite3 -version >> ENV.txt
cd /var/www/
export fileid=1K9At59IEsiCmzpCIUXITOcjpj77G8wYw
export filename=/var/www/Sport1090911.zip
wget -O $filename 'https://docs.google.com/uc?export=download&id='$fileid
echo "下載Sport1090911.zip OK" >> ENV.txt
unzip /var/www/Sport1090911.zip
rm /var/www/Sport1090911.zip -f
mv /var/www/Sport1090911 /var/www/Sport109
mv /var/www/Sport109 /var/www/html/Sport109
echo "建立/var/www/html/Sport109 OK" >> ENV.txt
mkdir /var/www/Sport_data
mkdir /var/www/Sport_data/Cache
echo "建立/var/www/Sport_data 與/var/www/Sport_data/Cache OK" >> ENV.txt
chown apache.apache /var/www/ -R
sed -i 's/'admin'/'學籍帳號'/g' /var/www/html/Sport109/109.conf.php
sed -i 's/'abc1234'/'學籍密碼'/g' /var/www/html/Sport109/109.conf.php
sed -i 's/074XXX/教育部學校代碼/g' /var/www/html/Sport109/109.conf.php
sed -i "s/API_client_id = ''/API_client_id = '雲端學籍系統學校的API_ID'/g" /var/www/html/Sport109/109.conf.php
sed -i "s/API_client_secret = '';/API_client_secret = '雲端學籍系統學校的_API_密碼';/g" /var/www/html/Sport109/109.conf.php
echo "設定109.conf.php OK" >> ENV.txt
cat ENV.txt
二、最後手動變更Sport109/109.conf.php
Sport109/109.conf.php 內容為
// 5.可寫入目錄(放置資料庫檔及暫存區用),建議搬至網頁目錄外
define('__SiteData', dirname(__file__).'/Sport_data/');
需改為
define('__SiteData', '/var/www/Sport_data/');
三、如何使用:
$sudo chmod +x Sport109EnvSetup.sh
$sudo sh Sport109EnvSetup.sh
四、以下為環境安裝步驟祥解:
yum install -y nano
cd /usr/bin/
ln -s nano pico
export EDITOR="pico"
4.安裝unzip wget vim nano 與校時
yum -y update
yum -y install unzip wget
yum -y install epel-release
wget --no-check-certificate https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7*.rpm
yum -y install vim-enhanced nano
echo "alias vi='vim'" >> /etc/profile
echo "set nu" >> /etc/vimrc
source /etc/profile
yum -y install ntp
ntpdate -d time.stdtime.gov.tw
echo '0 * * * * root /usr/sbin/ntpdate time.stdtime.gov.tw > /dev/null 2>&1' >>/etc/crontab
5.關閉 selinux 、ssh 關閉 root 帳號與關閉firewall
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
systemctl reload sshd
systemctl stop firewalld.service
systemctl disable firewalld.service
6.安裝httpd php7.3 sqlite3
yum -y install httpd
sed -i 's/Options Indexes FollowSymLinks/Options FollowSymLinks/g' /etc/httpd/conf/httpd.conf
sed -i 's/DirectoryIndex index.html$/DirectoryIndex index.html index.htm/g' /etc/httpd/conf/httpd.conf
systemctl enable httpd
systemctl start httpd
chown -R apache.apache /var/www
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php70.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php71.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php72.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi-php74.repo
sed -i '/php73]/,/gpgkey/s/enabled=0/enabled=1/g' /etc/yum.repos.d/remi-php73.repo
yum -y install php php-gd php-mysql php-mcrypt php-intl php-pdo
sed -i 's/^.*date\.timezone.*=.*/date\.timezone = "Asia\/Taipei"/g' /etc/php.ini
sed -i 's/^.*display_errors.*=.*/display_errors = On/g' /etc/php.ini
sed -i 's/^.*max_execution_time.*=.*/max_execution_time = 150/g' /etc/php.ini
sed -i 's/^.*max_file_uploads.*=.*/max_file_uploads = 300/g' /etc/php.ini
sed -i 's/^.*max_input_time.*=.*/max_input_time = 120/g' /etc/php.ini
sed -i 's/^.*max_input_vars.*=.*/max_input_vars = 5000/g' /etc/php.ini
sed -i 's/^.*memory_limit.*=.*/memory_limit = 240M/g' /etc/php.ini
sed -i 's/^.*post_max_size.*=.*/post_max_size = 220M/g' /etc/php.ini
sed -i 's/^.*upload_max_filesize.*=.*/upload_max_filesize = 200M/g' /etc/php.ini
systemctl reload httpd
yum -y install sqlite-devel
echo " Apache 版本:" > ENV.txt
httpd -v >> ENV.txt
echo " PHP 版本:" >> ENV.txt
php -v >> ENV.txt
echo " Sqlite 版本:" >> ENV.txt
sqlite3 -version >> ENV.txt
7.從Google Driver下載 Sport1090911.zip
cd /var/www/
export fileid=1K9At59IEsiCmzpCIUXITOcjpj77G8wYw
export filename=Sport1090911.zip
wget -O $filename 'https://docs.google.com/uc?export=download&id='$fileid
echo "下載Sport1090911.zip OK" >> ENV.txt
8.解壓縮Sport1090911.zip並更名,後將Sport109移往/var/www/html 與變更擁有者
unzip /var/www/Sport1090911.zip
rm /var/www/Sport1090911.zip -f
mv /var/www/Sport1090911 /var/www/Sport109
mv /var/www/Sport109 /var/www/html/Sport109
mkdir /var/www/Sport_data
mkdir /var/www/Sport_data/Cache
chown apache.apache /var/www/ -R
9.變更Sport109/109.conf.php
sed -i 's/'admin'/'學籍帳號'/g' /var/www/html/Sport109/109.conf.php
sed -i 's/'abc1234'/='學籍密碼'/g' /var/www/html/Sport109/109.conf.php
sed -i 's/'074XXX'/'教育部學校代碼'/g' /var/www/html/Sport109/109.conf.php
sed -i "s/API_client_id = '';/API_client_id = '雲端學籍系統學校的API_ID';/g" /var/www/html/Sport109/109.conf.php
sed -i "s/API_client_secret = '';/API_client_secret = '雲端學籍系統學校的_API_密碼';/g" /var/www/html/Sport109/109.conf.php
10.手動變更Sport109/109.conf.php
Sport109/109.conf.php 內容為
// 5.可寫入目錄(放置資料庫檔及暫存區用),建議搬至網頁目錄外
define('__SiteData', dirname(__file__).'/Sport_data/');
需改為
define('__SiteData', '/var/www/Sport_data/');
沒有留言:
張貼留言