一、搭建nginx

1)基础依赖包安装

yum -y install gcc gcc-c++ vim tree make cmake autoconf
yum -y install openssl openssl-devel openssl-clients curl curl-devel \
yum -y install wget rsync expect readline readline-devel bison bison-devel \
yum -y install pcre pcre-devel zlib-devel zlib freetype freetype-devel man \
yum -y install lrzsz tar iostat bc zip unzip lvm2 sysstat

2)nginx环境准备

useradd nginx -s /sbin/nologin -M
wget http://nginx.org/download/nginx-1.9.9.tar.gz
tar xf nginx-1.9..tar.gz
cd nginx-1.9.

问题处理

./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries. [root@web- nginx-1.9.]# yum -y install gd-devel

yum -y install openssl openssl-devel

3)编译参数。指定目录 /opt/lnmp_zabbix/nginx

./configure \
--prefix=/opt/lnmp_zabbix/nginx \
--user=nginx \
--group=nginx \
--conf-path=/opt/lnmp_zabbix/nginx/conf/nginx.conf \
--error-log-path=/opt/lnmp_zabbix/nginx/log/error.log \
--http-log-path=/opt/lnmp_zabbix/nginx/log/access.log \
--http-client-body-temp-path=/opt/lnmp_zabbix/nginx/client/ \
--http-proxy-temp-path=/opt/lnmp_zabbix/nginx/proxy/ \
--http-fastcgi-temp-path=/opt/lnmp_zabbix/nginx/fcgi/ \
--http-uwsgi-temp-path=/opt/lnmp_zabbix/nginx/uwsgi \
--http-scgi-temp-path=/opt/lnmp_zabbix/nginx/scgi --with-pcre \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_realip_module \
--pid-path=/opt/lnmp_zabbix/nginx/nginx.pid \
--with-file-aio --with-http_image_filter_module \
--with-stream   # tcp 代理 # --with-pcre=/opt/lnmp_zabbix/pcre-8.35 \
# --with-zlib=/opt/lnmp_zabbix/zlib-1.2. \
# --with-openssl=/opt/lnmp_zabbix/openssl-1.0.1i

3)编译成功则执行

make && make install

二、编译安装mysql(方法一)

1) 下载mysql,创建mysql用户

groupadd mysql
useradd -r -g mysql mysql -s /sbin/nologin wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.41.tar.gz
tar xf mysql-5.6..tar.gz
cd mysql-5.6.

2) 执行编译过程

cmake \
-DCMAKE_INSTALL_PREFIX=/opt/lnmp_zabbix/mysql \
-DMYSQL_DATADIR=/opt/lnmp_zabbix/mysql/data \
-DMYSQL_UNIX_ADDR=/opt/lnmp_zabbix/mysql.sock \
-DWITH_MEMORY_STORAGE_ENGINE= \
-DWITH_PARTITION_STORAGE_ENGINE= \
-DWITH_ARCHIVE_STORAGE_ENGINE= \
-DWITH_BLACKHOLE_STORAGE_ENGINE= \
-DWITH_FEDERATED_STORAGE_ENGINE= \
-DWITH_INNOBASE_STORAGE_ENGINE= \
-DWITH_MYISAM_STORAGE_ENGINE= \
-DWITH_READLINE= \
-DENABLED_LOCAL_INFILE= \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT= \
-DSYSCONFDIR=/etc \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_SSL=system \
-DINSTALL_SHAREDIR=share make && make install

3)查看编译后的文件

[root@zabbix mysql]# ls /opt/lnmp_zabbix/mysql/
bin COPYING data docs include lib man mysql-test README scripts share sql-bench support-files
[root@zabbix mysql]# ll -sh /opt/lnmp_zabbix/mysql/
total 68K
.0K drwxr-xr-x root root .0K Nov : bin
20K -rw-r--r-- root root 18K Jun : COPYING
.0K drwxr-xr-x root root .0K Nov : data
.0K drwxr-xr-x root root .0K Nov : docs
.0K drwxr-xr-x root root .0K Nov : include
.0K drwxr-xr-x root root .0K Nov : lib
.0K drwxr-xr-x root root .0K Nov : man
.0K drwxr-xr-x root root .0K Nov : mysql-test
.0K -rw-r--r-- root root .5K Jun : README
.0K drwxr-xr-x root root .0K Nov : scripts
.0K drwxr-xr-x root root .0K Nov : share
.0K drwxr-xr-x root root .0K Nov : sql-bench
.0K drwxr-xr-x root root .0K Nov : support-files

4)myql的配置文件(后续操作,为了移植程序包)

[root@zabbix mysql]# cp /opt/lnmp_zabbix/mysql/support-files/my-default.cnf /etc/my.cnf
创建关键行目录
mkdir -p /opt/lnmp_zabbix/mysql/data
mkdir -p /opt/lnmp_zabbix/mysql/logs
cd /opt/lnmp_zabbix/
touch logs/error.log
chown -R mysql:mysql /opt/lnmp_zabbix/mysql/data/mysql # 可能有错

5)初始话mysql

/opt/lnmp_zabbix/mysql/scripts/mysql_install_db --user=mysql --datadir=/opt/lnmp_zabbix/mysql/data/

6)设置开机自启动加入目录

cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start # 设置 ROOT 密码
./bin/mysqladmin -u root password

三、直接使用安装好的mysql文件

1)上传mysql压缩包文件到/usr/local/

[root@mysqltest local]# ls /usr/local/mysql*
/usr/local/mysql.20170704.152.tgz

2、检查是否有/usr/bin/perl 这个文件

[root@mysqltest opt]# ll /usr/bin/perl
-rwxr-xr-x. root root Nov /usr/bin/perl
如果没有执行安装命令
yum install -y perl perl-devel

3)在/usr/local/下 创建mysql启动脚本文件。mysqld_init.sh

cat  mysqld_init.sh
tar xf /usr/local/mysql.20170704.152.tgz
useradd mysql -s /sbin/nologin -M
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
mkdir -p /data/mysql_data/tmp/
chown -R mysql.mysql /data/mysql_data/
mkdir -p /data/mysql_binlog/
chown -R mysql.mysql /data/mysql_binlog/
mv /etc/my.cnf /etc/my.cnf.bak
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
mkdir -p /usr/local/mysql/logs
touch /usr/local/mysql/logs/error.log
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql_data --user=mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start
/usr/local/mysql/bin/mysqladmin -u root password 123456

4)执行启动脚本文件 /bin/bash usr/local/mysqld_init.sh

5) 测试

、此时mysql已经启动起来了,可以检查端口测试
进入mysql ==》mysql -uroot -p

四、编译安装php文件

依赖包安装

yum install libxml2 libxml2-devel -y

yum install bzip2 bzip2-devel

yum -y install libxslt libxslt-devel

yum -y install libcurl libcurl-devel

yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
tar -zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure  --prefix=/usr/local
make
make install

1)下载源码包

wget http://cn2.php.net/distributions/php-5.6.24.tar.gz
tar xf php-5.6..tar.gz
cd php-5.6.24

2)为了make,php时避免报错。检查,

lrwxrwxrwx 1 root root 41 Nov 24 11:58 /usr/lib/libmysqlclient.so.18 -> /usr/local/mysql/lib/libmysqlclient.so.18

php.make时会报该错误
error while loading shared libraries: libmysqlclient.so.: cannot open shared object file: No such file or directory
解决问题1
[root@zabbix php-5.6.]# ln -s /usr/local/mysql/lib/libmysqlclient.so. /usr/lib
[root@zabbix php-5.6.]# ldconfig

3) 编译参数

./configure \
--prefix=/opt/lnmp_zabbix/php \
--with-config-file-path=/opt/lnmp_zabbix/php/etc \
--with-mysql=/usr/local/mysql \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/opt/lnmp_zabbix/libiconv \
--with-freetype-dir \
--with-bz2 \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--with-xmlwriter-dir=/usr \
--with-xmlreader-dir=/usr \
--with-libdir=lib \
--with-gettext \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no

php编译参数

4) 执行成功后 make && make install

5) 启动

cp /opt/lnmp_zabbix/php/etc/php-fpm.conf.default /opt/lnmp_zabbix/php/etc/php-fpm.conf
[root@zabbix php]# /opt/lnmp_zabbix/php/sbin/php-fpm
[root@zabbix sbin]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /sshd
tcp 127.0.0.1: 0.0.0.0:* LISTEN /master
tcp 127.0.0.1: 0.0.0.0:* LISTEN /php-fpm
tcp ::: :::* LISTEN /sshd
tcp ::: :::* LISTEN /master
tcp ::: :::* LISTEN /mysqld

五、编译安装zabbix

1)下载zabbix3以上版本

yum install -y net-snmp-devel
groupadd -g zabbix
useradd -g zabbix -u -m zabbix https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.5/zabbix-3.2.5.tar.gz tar xf zabbix-3.2..tar.gz
cd zabbix-3.2..tar.gz

2) 编译安装

./configure \
--prefix=/usr/local/zabbix \
--sysconfdir=/etc/zabbix/ \
--enable-server \
--enable-agent \
--with-net-snmp \
--with-libcurl \
--with-mysql=/usr/local/mysql/bin/mysql_config \
--with-libxml2 make && make install

3)配置zabbix

3.1)建立mysql的数据库

mysql -uroot -p
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
mysql> flush privileges;
mysql> show databases;

3.2)导入zabbix的库

cd zabbix-3.2.
/usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
/usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
/usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql

3.3)配置zabbix的配置文件

vim /etc/zabbix/zabbix_server.conf
DBHost=localhost 数据库ip地址
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=127.0.0.1,192.168.1.10 zabbix server ip地址

3.4)设置zabbix的启动文件

设置防火墙(线上先检查防火墙再执行)
# iptables -I INPUT -p tcp -m multiport --dports 10050:10051 -j ACCEPT
# service iptables save &&service iptables restart 做命令的软链接
ln -s /usr/local/zabbix/sbin/* /usr/sbin/
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/ \\zabbix目录
chmod +x /etc/init.d/zabbix_*
sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_server \\写入系统服务

六、配置web服务

1)修改nginx的启动脚本文件

[root@zabbix conf]# cat /opt/lnmp_zabbix/nginx/conf/nginx.conf
user nginx;
worker_processes ;
worker_cpu_affinity ;
worker_rlimit_nofile ; pid /var/run/nginx.pid; events {
worker_connections ;
use epoll;
multi_accept off;
} http {
include /opt/lnmp_zabbix/nginx/conf/mime.types;
default_type application/octet-stream; log_format main '$remote_addr --- $remote_user --- [$time_local] --- $request --- '
'"$status" --- $body_bytes_sent --- "$http_referer" --- '
'"$http_user_agent" --- "$http_x_forwarded_for"';
log_format mtr '$remote_addr [$time_local] "$request_uri" '
'$status "$http_referer" '
'"$http_user_agent" "$host"'; sendfile on; keepalive_timeout ;
client_header_timeout ;
client_body_timeout ;
server_tokens off;
tcp_nodelay on; gzip on; include /opt/lnmp_zabbix/nginx/conf/vhost/*.conf; fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
#fastcgi_buffer_size 16k;
#fastcgi_buffers 16 16k;
#fastcgi_busy_buffers_size 16k;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k; server_names_hash_bucket_size 128;
client_header_buffer_size 2k;
large_client_header_buffers 4 4k;
client_max_body_size 100k;
open_file_cache max=51200 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
}

nginx.conf

配置vhost/zabbix.conf

[root@zabbix conf]# cat /opt/lnmp_zabbix/nginx/conf/vhost/zabbix.conf
server {
listen ;
charset utf8;
server_name localhost;
access_log /opt/lnmp_zabbix/nginx/log/zabbix.log main;
error_log /opt/lnmp_zabbix/nginx/log/error.log;
index index.html index.php index.html;
root /opt/wwwroot/zabbix; location /{
try_files $uri $uri/ /index.php?$args;
} location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

2)拷贝项目目录到/opt/wwwroot/zabbix

cd /root/tools/zabbix-3.2.
cp -r frontends/php/* /opt/wwwroot/zabbix/

3) 重启nginx,php,mysql,zabbix

打开网页,说明成功了一大半了

但配置页面由于php的原因,检查一些设置会失败

七、配置php

1)设置php的配置文件,php.ini

cp /root/tools/php-5.6./php.ini-production /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 16M/' /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/' /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/max_input_time = 60/max_input_time = 300/' /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/;date.timezone =/date.timezone = Asia\/Shanghai/' /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/mysqli.default_socket =/& \/home\/mysql\/var\/mysql.sock/' /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/mysqli.default_host =/& localhost/' /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/mysqli.default_user =/& zabbix/' /opt/lnmp_zabbix/php/etc/php.ini
sed -i 's/;always_populate_raw_post_data = -1/always_populate_raw_post_data = -1/' /opt/lnmp_zabbix/php/etc/php.ini

2)写php开机自启动的脚本文件  vim /etc/init.d/php-fpm

[root@zabbix sbin]# cat /etc/init.d/php-fpm
#!/bin/sh
# Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network # Check that networking is up.
[ "$NETWORKING" = "no" ] && exit phpfpm="/opt/lnmp_zabbix/php/sbin/php-fpm"
prog=$(basename ${phpfpm}) lockfile=/var/lock/subsys/phpfpm start() {
[ -x ${phpfpm} ] || exit
echo -n $"Starting $prog: "
daemon ${phpfpm}
retval=$?
echo
[ $retval -eq ] && touch $lockfile
return $retval
} stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq ] && rm -f $lockfile
return $retval
} restart() {
configtest || return $?
stop
start
} reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc ${phpfpm} -HUP
RETVAL=$?
echo
} force_reload() {
restart
} configtest() {
${phpfpm} -t
} rh_status() {
status $prog
} rh_status_q() {
rh_status >/dev/null >&
} case "$1" in
start)
rh_status_q && exit
$
;;
stop)
rh_status_q || exit
$
;;
restart|configtest)
$
;;
reload)
rh_status_q || exit
$
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|configtest}"
exit
esac

/etc/init.d/php-fpm

chmod +x  /etc/init.d/php-fpm

[root@zabbix sbin]# /etc/init.d/php-fpm stop
Stopping php-fpm: [ OK ]
[root@zabbix sbin]# /etc/init.d/php-fpm start
Starting php-fpm: [ OK ]

3)再次访问http://192.168.10.45:89/setup.php ,可进入下一步系统配置

Admin/zabbix

4)zabbix客户端配置

[root@k8s5 ~]# egrep -v "^#|^$" /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=
Server=192.168.10.45
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/*.conf

测试:    /usr/local/zabbix/bin/zabbix_get -s 10.0.5.21 -p 10050 -k "system.uptime"

yum -y localinstall *.rpm  安装当前文件夹文件

八、zabbix常见问题归纳

1)zabbix-agent 不能创建进程id

zabbix_agentd []: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [] No such file or directory

[root@k8s5 ~]# ll /var/run/zabbix/
ls: 无法访问/var/run/zabbix/: 没有那个文件或目录
[root@k8s5 ~]# mkdir -p /var/run/zabbix
[root@k8s5 ~]# touch /var/run/zabbix/zabbix_agentd.pid 再给权限
chown zabbix:zabbix /var/run/zabbix/

九、报警信息

注意:zabbix模板的默认监控里面 :

1 min average per core " 是每个core 的平均值,不是CPU 的平均值。 一个cpu可以有多个 core

即监控的数值需要乘以核数。

编译搭建lnmp+zabbix的更多相关文章

  1. 源码编译搭建LNMP环境

    LNMP源码编译 1.LNMP介绍 LNMP=Linux Nginx Mysql PHP Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器.Ng ...

  2. CentOS 6.5 源码编译搭建LNMP(三台独立主机实现)

    搭建前准备: 1.三台独立主机 nginx:192.168.1.102 php-fpm:192.168.1.105 mysql:192.168.1.103 2.相关软件的源码包 nginx:nginx ...

  3. LNMP+zabbix分布式监控搭建及版本升级

    LNMP+zabbix分布式监控搭建需要组件:gcc gcc-c++ openssl* pcre pcre-devel gd gd-devel libjpeg-devel libpng-devel l ...

  4. centos7编译安装zabbix(附带编译安装lnmp)

    先把防火墙和selinux关闭: sytemctl stop firewalld setenforce 0 1.yum安装依赖: yum -y install wget openssl* gcc gc ...

  5. LNMP+Zabbix搭建

    LNMP+Zabbix搭建 cmake2.8.8,Nginx-1.6.3,Php-5.5.38,Mysql-5.5.32,Zabbix-3.2.6 修改 /etc/selinux/config 文件中 ...

  6. 源码编译配置lnmp部署zabbix

    环境说明: [root@wcy ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@wcy ~]# uname -a Linux ...

  7. LNMP+Zabbix的安装与部署

    LNMP+Zabbix的安装与部署 一.Zabbix简介 1.zabbix是一个基于WEB界面的,并提供分布式系统监视以及网络监视功能的企业级的开源解决方案. zabbix能监视各种网络参数,保证服务 ...

  8. centos下编译安装lnmp

    centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...

  9. CentOS6.6搭建LNMP环境

    CentOS6.6搭建LNMP环境 1.设置yum源,本地安装依赖包 1 yum -y install gcc gcc-c++ automake autoconf libtool make 2.下载依 ...

随机推荐

  1. 3、zookeeper 集群模式搭建

    服务器 1:192.168.1.81  端口:2181.2881.3881 服务器 2:192.168.1.82  端口:2182.2882.3882 服务器 3:192.168.1.83  端口:2 ...

  2. ADB文件及文件夹操作

    1.创建文件夹: adb shell mkdir /data/local/tmp/local多级的一次只能创建一级adb shell mkdir /data/local/tmp/local/tmp 2 ...

  3. Linux下载命令之rpm和yum比较

    RPM和YUM比较 rpm 是linux的一种软件包名称,以.rmp结尾,安装的时候语法为:rpm -ivh,rpm包的安装有一个很大的缺点就是文件的关联性太大,有时候装一个软件要安装很多其他的软件包 ...

  4. Java 四种引用介绍及使用场景

    强引用-FinalReference 介绍: 强引用是平常中使用最多的引用,强引用在程序内存不足(OOM)的时候也不会被回收,使用方式: String str = new String("s ...

  5. 【Python】pip国内安装源和yum恢复

    豆瓣安装源 pip install packages -i http://pypi.doubanio.com/simple --upgrade --trusted-host pypi.doubanio ...

  6. JAVA Aes加解密详解

    上篇随笔留了一个问题,两种加密结果不一样? 其实是内部实现方式不一样,具体见注释 /** * 提供密钥和向量进行加密 * * @param sSrc * @param key * @param iv ...

  7. java枚举类型

    jvm并不支持枚举类型,java中枚举类型是在编译器层面上实现的,先看如下代码: package demo.nio; public class EnumDemo { public static enu ...

  8. dto vo

    不过符合规矩的做法是DTO里可以放各种List<VO>,而VO和entity就是一一对应的关系,vo里不能放entity,entity里也不能放vo,vo和entity只存放和数据库完全相 ...

  9. python入门 -- 学习笔记1

    学习资料:笨方法学Python 准备: 安装环境----请自行网络搜索(Windows安装很简单,和其他安装程序一样) 找一个自己习惯的编辑器(比如:sublime text 3) 创建一个专门的目录 ...

  10. [leetcode]265. Paint House II粉刷房子(K色可选)

    There are a row of n houses, each house can be painted with one of the k colors. The cost of paintin ...