2017年8月31日 星期四
Proxmox - Debian 8 LXC 初始環境設定
1. 將更新的 Server 都指向國家高速網路中心
cp /etc/apt/sources.list /etc/apt/sources.list.$(date +%F)
sed -i 's/ftp.debian.org/free.nchc.org.tw/g' /etc/apt/sources.list
清除所有的
apt-get clean all
更新套件庫
apt-get update -y
2. 進行套件更新
apt-get upgrade -y
3. 補足缺少的套件 cp /etc/apt/sources.list /etc/apt/sources.list.$(date +%F)
sed -i 's/ftp.debian.org/free.nchc.org.tw/g' /etc/apt/sources.list
清除所有的
apt-get clean all
更新套件庫
apt-get update -y
2. 進行套件更新
apt-get upgrade -y
apt-get install -y vim zip unzip mailutils ntpdate rsync sysv-rc-conf
4. 讓終端機程式可以輸入及顯示中文
dpkg-reconfigure locales
vim /etc/default/locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
/usr/bin/locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
5. 時區及預設編輯器設定
tail -2 /etc/profile
export TZ="Asia/Taipei"
export EDITOR="/usr/bin/vim"
/usr/bin/tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) coord - I want to use geographical coordinates.
12) TZ - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country whose clocks agree with yours.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 43
The following information has been given:
Taiwan
Therefore TZ='Asia/Taipei' will be used.
Local time is now: Tue Feb 28 22:47:26 CST 2017.
Universal Time is now: Tue Feb 28 14:47:26 UTC 2017.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='Asia/Taipei'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Taipei
6. 安裝 snmpd
apt-get install snmpd snmp
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.$(date +%F)
echo 'rocommunity public' > /etc/snmp/snmpd.conf
chmod 600 /etc/snmp/snmpd.conf
update-rc.d snmpd defaults
/etc/init.d/snmpd restart
2017年8月28日 星期一
2017年8月23日 星期三
2017年8月11日 星期五
Proxmox - CentOS 6 LXC 初始環境設定
1. 安裝 OpenSSH Server
yum install -y openssh-server
2. 修改套件更新來源
備份原設定檔
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date +%F)
將 mirrorlist 那一行的前面加上 # 註解 yum install -y openssh-server
2. 修改套件更新來源
備份原設定檔
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date +%F)
sed -i 's,mirrorlist=http://mirrorlist.centos.org,#mirrorlist=http://mirrorlist.centos.org,' /etc/yum.repos.d/CentOS-Base.repo
把 #baseurl 前面的 # 去除
sed -i 's,#baseurl=http://mirror.centos.org,baseurl=http://mirror.centos.org,' /etc/yum.repos.d/CentOS-Base.repo
將 http://mirror.centos.org/centos/ 替換成 ftp://140.111.74.109/CentOS/
sed -i 's,http://mirror.centos.org/centos/,ftp://140.111.74.109/CentOS/,' /etc/yum.repos.d/CentOS-Base.repo
安裝 EPEL 套件庫
yum install -y epel-release
去除舊的 yum cache
yum clean all
開始進行更新
yum update -y
3.補足缺少的套件
yum install -y vim nano yum-utils bind-utils mlocate zip unzip wget ntpdate net-snmp net-snmp-utils xzyum install -y fail2ban ssmtp logwatch cronie
4. 設定時區及預設編輯器
vim /etc/profile
yum install -y vim nano yum-utils bind-utils mlocate zip unzip wget ntpdate net-snmp net-snmp-utils xzyum install -y fail2ban ssmtp logwatch cronie
4. 設定時區及預設編輯器
vim /etc/profile
在 /etc/profile 中加入
# 將預設編輯器改成 vim
export EDITOR="/usr/bin/vim"
export TZ="Asia/Taipei"
# 加入 alias
alias ls='ls -F --color'
alias cls='clear'
alias grep='grep --color=auto'
alias cp='cp -i'
alias mv='mv -i'
5. 安裝 LAMP
yum install -y mysql-server httpd php php-mysql php-gd php-mbstring php-pear php-xml
設定開機時啟動
chkconfig --level 3 httpd on
chkconfig --level 3 mysqld on
啟動服務
service httpd start
service mysqld start
MySQL Server 初始化設定
/usr/bin/mysql_secure_installation
# 將預設編輯器改成 vim
export EDITOR="/usr/bin/vim"
export TZ="Asia/Taipei"
# 加入 alias
alias ls='ls -F --color'
alias cls='clear'
alias grep='grep --color=auto'
alias cp='cp -i'
alias mv='mv -i'
5. 安裝 LAMP
yum install -y mysql-server httpd php php-mysql php-gd php-mbstring php-pear php-xml
設定開機時啟動
chkconfig --level 3 httpd on
chkconfig --level 3 mysqld on
啟動服務
service httpd start
service mysqld start
MySQL Server 初始化設定
/usr/bin/mysql_secure_installation
Proxmox - CentOS 7 LXC 初始環境設定
1. 安裝 OpenSSH Server
yum install -y openssh-server
設定開機時啟動 OpenSSH Server
systemctl enable sshd.service
啟動 OpenSSH Server
systemctl start sshd.service
2. 修改套件更新來源 yum install -y openssh-server
設定開機時啟動 OpenSSH Server
systemctl enable sshd.service
啟動 OpenSSH Server
systemctl start sshd.service
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date +%F)
將 mirrorlist 那一行的前面加上 # 註解
sed -i 's,mirrorlist=http://mirrorlist.centos.org,#mirrorlist=http://mirrorlist.centos.org,' /etc/yum.repos.d/CentOS-Base.repo
把 #baseurl 前面的 # 去除
sed -i 's,#baseurl=http://mirror.centos.org,baseurl=http://mirror.centos.org,' /etc/yum.repos.d/CentOS-Base.repo
將 http://mirror.centos.org/centos/ 替換成 ftp://140.111.74.109/CentOS/
sed -i 's,http://mirror.centos.org/centos/,ftp://140.111.74.109/CentOS/,' /etc/yum.repos.d/CentOS-Base.repo
安裝 EPEL 套件庫
yum install -y epel-release
去除舊的 yum cache
yum clean all
開始進行更新
yum update -y
3.補足缺少的套件
yum install -y which vim nano yum-utils net-tools bind-utils mlocate zip unzip wget iptables-services ntpdate net-snmp net-snmp-utils bzip2 lsof less
yum install -y fail2ban ssmtp logwatch cronie
systemctl enable fail2ban.service
systemctl start fail2ban.service
4. 設定時區及預設編輯器
yum install -y which vim nano yum-utils net-tools bind-utils mlocate zip unzip wget iptables-services ntpdate net-snmp net-snmp-utils bzip2 lsof less
yum install -y fail2ban ssmtp logwatch cronie
systemctl enable fail2ban.service
systemctl start fail2ban.service
4. 設定時區及預設編輯器
vim /etc/profile
在 /etc/profile 中加入
# 將預設編輯器改成 vim
export EDITOR="/usr/bin/vim"
export TZ="Asia/Taipei"
# 加入 alias
alias ls='ls -F --color'
alias cls='clear'
alias grep='grep --color=auto'
alias cp='cp -i'
alias mv='mv -i'
# 將預設編輯器改成 vim
export EDITOR="/usr/bin/vim"
export TZ="Asia/Taipei"
# 加入 alias
alias ls='ls -F --color'
alias cls='clear'
alias grep='grep --color=auto'
alias cp='cp -i'
alias mv='mv -i'
5. 安裝 LAMP
yum install -y httpd mariadb mariadb-server php php-mysql php-gd php-pear php-xml php-xmlrpc php-mbstring php-soap
yum install -y php-bcmath php-dba php-embedded php-enchant php-fpm php-intl php-mysqlnd php-odbc php-pspell
---> Package hunspell.x86_64 0:1.3.2-15.el7 will be installed
--> Processing Dependency: hunspell-en-US for package: hunspell-1.3.2-15.el7.x86_64
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
--> Running transaction check
---> Package hunspell-en-US.noarch 0:0.20121024-5.el7 will be installed
--> Processing Conflict: php-mysql-5.4.16-42.el7.x86_64 conflicts php-mysqlnd
--> Finished Dependency Resolution
Error: php-mysql conflicts with php-mysqlnd-5.4.16-42.el7.x86_64
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
php-5.4.16-42.el7.x86_64 has missing requires of httpd-mmn = ('0', '20120211x8664', None)
PHP 使用mysqlnd 取代libmysql – Linux 技術手札
2017年2月13日 - 當系統已經安裝了php-mysql, 安裝php-mysqlnd 時會出現以下報錯: ... Error: php- mysql conflicts with php-mysqlnd-5.4.16-42.el7.x86_64.
yum install -y php-recode php-soap php-xmlrpc rrdtool-php uuid-php php-pecl-memcache
6. 設定開機時啟動
systemctl enable httpd.service
systemctl enable mariadb.service
systemctl start httpd.service
systemctl start mariadb.service
7. 設定 MariaDB SQL Server
/usr/bin/mysql_secure_installation