标签:glibc 编译 like yum out def org sof back
当前系统信息:
[root@localhost ~]# cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"
当前内核版本
[root@localhost ~]# uname -r 3.10.0-957.10.1.el7.x86_64
解压haproxy包:
[root@localhost ~]# tar zxvf haproxy-1.8.20.tar.gz
安装依赖包:
[root@localhost ~]# yum install -y gcc 或者 [root@localhost ~]# yum install gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools vim iotop bc zip unzip zlib-devel lrzsz tree screen lsof tcpdump wget ntpdate
#编译需要GCC来编译,下边一条安装了众多常用的工具。
编译安装:
[root@localhost ~]# cd haproxy-1.8.20
[root@localhost ~]# make TARGET=linux2628 PREFIX=/usr/local/haproxy #haproxy编译需要指定对应的内核版本,此参数可以查看README文件中有对应的值linux2628
[root@localhost ~]# make install PREFIX=/usr/local/haproxy
将haproxy拷贝到/usr/sbin/目录下:
[root@localhost ~]# cp -rf /usr/local/haproxy/sbin/haproxy /usr/sbin/
查看当前版本:
[root@localhost ~]# haproxy -v HA-Proxy version 1.8.20 2019/04/25 Copyright 2000-2019 Willy Tarreau <willy@haproxy.org>
添加配置文件:
[root@localhost ~]# mkdir /usr/local/haproxy/conf [root@localhost ~]# vim /usr/local/haproxy/conf/haproxy.conf
配置文件内容如下(精简配置):
global daemon maxconn 256 defaults mode http timeout connect 5000ms timeout client 50000ms timeout server 50000ms frontend http-in bind *:80 default_backend web_servers backend web_servers server server1 127.0.0.1:8000 maxconn 32
启动haproxy
[root@localhost ~ ] haproxy -f /usr/local/haproxy/conf/haproxy.conf
标签:glibc 编译 like yum out def org sof back
原文地址:https://www.cnblogs.com/yyxianren/p/10942118.html