这是一台在虚拟云上开的服务器。
采用yum安装软件的时候,出现下面错误:
yum -y install gcc
base/7/x86_64/primary_db FAILED
http://mirrors.163.com/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e1... [Errno 12] Timeout on http://mirrors.163.com/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e1... (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
改了DNS等、数据源网上常用的方法都不行。经测试,发现通过wget下载bz2类的文件都不行。tar.gz的却是可以的。这个问题暂时不能解决。采用编译来安装吧。
然后重新安装了操作系统。一切OK。可能是相关的一些软件包没有安装的原因。
CentOS-7-x86_64-DVD-1611.iso(CentOS Linux release 7.3.1611 (Core),Linux version 3.10.0-514.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Nov 22 16:42:41 UTC 2016)
最小安装,软件包中,只选择开发工具。
网卡在/etc/sysconfig/network-scripts/底下。
添加:
BOOTPROTO=static
IPADDR=10.1.1.101
NETMASK=255.255.255.0
GATEWAY=10.1.1.254
DNS=114.114.114.114
NM_CONTROLLED=no
……
ONBOOT=yes
service network restart
yum -y install gcc
yum -y install gcc-c++
yum -y install bzip2
yum install apr-devel apr apr-util
安装openssl-1.1.0f需要perl5
yum install expat-devel
yum -y install httpd
/sbin/chkconfig httpd on
/sbin/service httpd start
setenforce 0
vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
修改配置文件需要重启机器
#停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
reboot
yum -y install epel-release
yum -y install libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel
yum install gd
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php71w php71w-mysql php71w-odbc php71w-common php71w-embedded php71w-pgsql php71w-xml php71w-ldap php71w-fpm php71w-gd php71w-pdo php71w-devel php71w-mbstring php71w-mcrypt php71w-cli php71w-json php71w-imap php71w-bcmath mod_php71w php71w-pear
(
中间会要求执行一个命令:yum load-transaction /tmp/yum_save_tx.2018-03-12.10-39.KbzAJq.yumtx
执行完以后,php才被安装成功。
)
php -v
service httpd restart
yum -y install cmake bison-devel ncurses-devel libaio libaio-devel perl-Data-Dumper net-tools
yum -y install which
yum -y install wget
1、安装MariaDB
rpm -qa | grep mysql
yum remove mysql mysql-server
yum remove mysql-devel
yum -y install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
首先是设置密码,会提示先输入密码。由于无密码,所以直接回车。
Enter current password for root (enter for none):<–初次运行直接回车
设置密码
abcde123
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
初始化MariaDB完成,接下来测试登录
mysql -uroot -p
完成。
2、配置MariaDB的字符集
vi /etc/my.cnf
在[mysqld]标签下添加
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
vi /etc/my.cnf.d/client.cnf
在[client]中添加
default-character-set=utf8
vi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
default-character-set=utf8
全部配置完成,重启mariadb
systemctl restart mariadb
之后进入MariaDB查看字符集
MariaDB [(none)]> show variables like "%character%";
显示为
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
show variables like "%collation%";
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
字符集配置完成。
3、添加用户,设置权限
授予外网登陆权限
grant all privileges on *.* to root@'%' identified by 'abcde123';
设置root不能远程mysql
use mysql;
select host,user from user;
update user set host = "localhost" where user = "root" and host = "%";
flush privileges;
在10.1.1.18上
CREATE DATABASE `datapp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'datapp'@'%' IDENTIFIED BY 'abcde123';
GRANT ALL PRIVILEGES ON datapp.* TO 'datapp'@'%' IDENTIFIED BY 'abcde123';
FLUSH PRIVILEGES;
mkdir /home/www
mkdir /home/logs
vi /etc/httpd/conf/httpd.conf
将DocumentRoot设为/home/www和logs的目录改到/home/logs
安装 ffmpeg
配置php.ini文件
file_uploads = on ;//是否允许通过HTTP上传文件的开关。默认为ON即是开
upload_tmp_dir ;//文件上传至服务器上存储临时文件的地方,如果没指定就会用系统默认的临时文件夹
upload_max_filesize = 1024m ;//望文生意,即允许上传文件大小的最大值。默认为2M,我们设置为1G
post_max_size = 1024m ;//指通过表单POST给PHP的所能接收的最大值,我们也设置为1G
max_execution_time = 3600 ;//每个PHP页面运行的最大时间值(秒),默认30秒,设置为一小时,因为后面转码时间很久。
max_input_time = 36000 ;//每个PHP页面接收数据所需的最大时间,默认60秒
memory_limit = 8m ;//每个PHP页面所吃掉的最大内存,默认8M
添加安装源
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
安装
(yum install x264)(看下有没有必要)
yum install ffmpeg ffmpeg-devel -y
测试是否安装成功
ffmpeg
安装percona-xtrabackup
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.3.5/binary/redhat/7/x86_64/percona-xtrabackup-2.3.5-1.el7.x86_64.rpm
yum localinstall percona-xtrabackup-2.3.5-1.el7.x86_64.rpm
卸载
yum remove percona-xtrabackup
mkdir /var/lib/mysql/new_jgz
## 解包
cat <数据备份文件名>_qp.xb | xbstream -x -v -C /var/lib/mysql/new_jgz
## 解压
innobackupex --decompress --remove-original /var/lib/mysql/new_jgz
出错
配置虚拟主机
vi /etc/httpd/conf/httpd.conf
添加
Listen 8080
vi /etc/httpd/conf.d/vhostport.conf
<Directory /home/www/gz_news>
Order allow,deny
Allow from all
</Directory>
NameVirtualHost 10.1.1.101:80
<VirtualHost 10.1.1.101:80>
ServerAdmin admin@wgzrbs.com.cn
DocumentRoot /home/www/gz_news
ServerName www.gzrbs.com.cn
</VirtualHost>
NameVirtualHost 10.1.1.101:8080
<VirtualHost 10.1.1.101:8080>
ServerAdmin admin@gzrbs.com.cn
DocumentRoot /home/www/gz_news/hd/public
ServerName app.gzrbs.com.cn
</VirtualHost>
php如果不能解析的话,考虑是否yum的时候漏了mod_php71w。
apache下有一个/etc/httpd/conf.d/welcome.conf文件,是找不到文件时自动指定的首页。可以删除掉。
centos7安装redis
yum install redis
service redis start
rpm -ql redis
redis-cli --version
设置为开机自动启动:
chkconfig redis on
或者
systemctl enable redis.service
星期二, 01/16/2018 - 16:43 — 杨超