新灌的一台Centos7可以做以下的設定
語系設定:
- sudo localectl set-locale LC_CTYPE=zh_TW.UTF-8
修改ssh port
- http://linux.vbird.org/linux_server/0310telnetssh.php#ssh_port
- sudo firewall-cmd --add-port 2222/tcp --permanent
- sudo systemctl restart sshd
修改mail server
- http://choons-world.blogspot.com/2017/11/
- 開機發信排程:
| # wait 2min to sure all service open
| (sleep 120
| echo -e "`who -b`\n`ifconfig`\n`systemctl list-units | grep running`\n\n\n\nSettings of mail: https://choons-world.blogspot.com/2017/11/centos-sendmail-by-gmail.html" | mail -s "Server on" xxxxx@gmail.com
| )&
XRDP設定:
- http://choons-world.blogspot.com/2017/07/centos7-xrdp.html
Lamp設定教程:
- http://choons-world.blogspot.com/2017/07/centos7-apachephp7mariadbphpmyadmin.html
- selinux可以設為perminant 這樣比較好設定
- 注意:如果用yum方式安裝 請先安裝php才安裝phpmyadmin
- Webserver路徑:/var/www/html/
- 注意權限問題 要讓apache可讀(如要修改及生成文件就要可寫)
Wordpress 移機(可忽略)
- 路徑: /var/www/html/wordpress
- 需要備份的話直接備份這個資料夾和資料庫,資料庫密碼詳見wp-config.php
- 移機簡略步驟:
| 1 複製及權限
| > sudo mv wordpress/ /var/www/html/
| > ll
| > cd /var/www/html/
| > lll
| > ll
| > chgrp -R apache wordpress
| > sudo chgrp -R apache wordpress
| 2 備份資料庫然後再匯入到新的一台 (帳號看 wp-config.php)
| 3 修改基礎設定(例如:網址等)
| 4 開帳號讓ftp使用 記得設為nologin
| > sudo useradd -d /var/www/html/ -s /sbin/nologin wordpress
| > sudo passwd wordpress
| 5 設置 ftp
| - http://linux.vbird.org/linux_server/0410vsftpd.php#server
| | > yum -y install vsftpd
| | > firewall-cmd --permanent --add-service=ftp
| | > vim /etc/vsftpd/vsftpd.conf
| | ====
| | anonymous_enable=NO
| | local_enable=YES
| | write_enable=YES
| | xferlog_std_format=YES
| | chroot_local_user=YES
| | use_localtime=YES
| | allow_writeable_chroot=YES
| | userlist_deny=YES
| | ==== #userlist_deny為YES 則user_list文件裡的user可以登入ftp; 假如為NO 則user_list文件裡user不可以登入ftp
| | > systemctl restart vsftpd
| | > systemctl enable vsftpd
| | > firewall-cmd --permanent --add-port=21/tcp
| | > firewall-cmd --permanent --add-service=ftp
| | > firewall-cmd —reload
| 6 更換owner
| > sudo chown -R wordpress wordpress
| 7 新增user wordpress登入ftp權限,給予wordpress權限給user
| > vim /etc/vsftpd/user_list
| | ==
| | wordpress
| | ==
crontab設定:
| $ cat /etc/crontab
| SHELL=/bin/bash
| PATH=/sbin:/bin:/usr/sbin:/usr/bin
| MAILTO=root
|
| # For details see man 4 crontabs
|
| # Example of job definition:
| # .---------------- minute (0 - 59)
| # | .------------- hour (0 - 23)
| # | | .---------- day of month (1 - 31)
| # | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| # | | | | |
| # * * * * * user-name command to be executed
| 0 0 1,15 * * root /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
| 0 0 1,15 * * root gitlab-ctl restart
| 0 3 * * * root sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
gitlab (可忽略)
- http://choons-world.blogspot.com/2017/08/install-gitlab-to-own-pc.html
- 記得備份後再更新
| > sudo yum install -y gitlab-ce
| - 更新時如果跨minor version 必須更新到該minor最後一版才能再升級到新的minor version
| - 例如:1.2.3 > 1.2.9 > 1.3.9 > 1.4.2
- 備份查看crontab每15天備份一次 還有重啟動1次
- 本地備份位置: /var/opt/gitlab/backups/
- 備份指令 /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
- 因為現在的gitlab內容較大 如果備份頻率較高,建議把舊的版本刪掉(可能只保留3個檔案)
- 跨機還原需要安裝與原版本的gitlab,如果需要新版本,則還原後再更新,choonsword裡有簡易的指令,但建議觀看網絡教程
- 設定檔 /etc/gitlab/gitlab.rb
| 每次修改完需要下以下兩個指令
| > sudo gitlab-ctl reconfigure
| > sudo gitlab-ctl restart
==============================
2018年9月1日 星期六
2017年7月17日 星期一
Centos7 安裝Apache+php7+mariadb+phpmyadmin
#更新yum
sudo yum update
# 把selinux 安全度降低
sudo vi /etc/sysconfig/selinux
找到 SELINUX=enforcing 然後修改為 SELINUX=disabled
要重新開機 reboot / restart 後才會套用
# 重開機先暫時用這個指令更換
sudo setenforce 0
#安裝apache
sudo yum install httpd
#打開apache
sudo service httpd start
#安裝mariadb的respo
sudo vim /etc/yum.repos.d/MariaDB.repo
====vim裡========
[mariadb]
name = MariaDB
gpgcheck=1
============
#安裝mariadb
sudo yum install MariaDB-server MariaDB-client
#打開並預設開機打開mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb
#設定mariadb
sudo mysql_secure_installation
#
#安裝php和phpmyadmin
sudo yum install php70w
sudo yum install phpmyadmin
#修改phpmyadmin使得可以遠端登入
cd /etc/httpd/conf.d/
sudo cp phpMyAdmin.conf phpMyAdmin.conf.bak
sudo vim phpMyAdmin.conf
=====vim======
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1 #註解掉
# Require ip ::1 #注释掉
Require all granted #新增這行
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1 #注释掉
#Require ip ::1 #注释掉
Require all granted #新增這行
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
==============
sudo sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --reload
sudo service httpd restart
sudo service httpd restart
訂閱:
文章 (Atom)
Centos GUI Webserver 設定
新灌的一台Centos7可以做以下的設定 語系設定: - sudo localectl set-locale LC_CTYPE=zh_TW.UTF-8 修改ssh port - http://linux.vbird.org/linux_server/0310telne...
-
現在市面上的智慧家居玲琅满目,上週的課程剛好有學到繼電器,所以就順帶做個智慧插座。這次DIY的智慧插座功能很簡單,純粹只用網頁開關插座,沒有其他功能。(RaspberryPi使用Python編寫,其實蠻容易擴充功能的。) 1. 首先,準備好RaspberryPi,麵包板、繼電...
-
安裝Anaconda 前往官網 https://www.continuum.io/downloads 下載sh bash Anaconda3-4.4.0-MacOSX-x86_64.sh #安裝設定 #新建環境 conda create --name crawlerP...
-
近期在玩 RaspberryPi,需要Lamp功能,邊裝邊紀錄過程,方便下次直接複製XD RaspberryPi + Apache + PHP + MariaDB + Phpmyadmin # 更新套件 sudo apt-get update & sudo apt...