2017年8月11日 星期五

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. 修改套件更新來源 
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. 設定時區及預設編輯器

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 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 

--> Running transaction check
---> 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 技術手札

https://www.phpini.com › PHP

2017年2月13日 - 當系統已經安裝了php-mysql, 安裝php-mysqlnd 時會出現以下報錯: ... Errorphp-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

沒有留言:

張貼留言