1.安装必要的库文件
yum install -y gcc*
2.yum安装camke
yum install -y cmake
编译安装cmake
cd /usr/local/src
wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
./configure
make
make install
3.安装 MYSQL
cd /usr/local/src
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.29.tar.gz
groupadd mysql
useradd -g mysql -M -s /sbin/nologin mysql
tar zxf mysql-5.6.29.tar.gz
cd mysql-5.6.29
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install
cd /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
./scripts/mysql_install_db --user=mysql -datadir=/data/mysql
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
bin/mysqld_safe --user=mysql &
/etc/init.d/mysqld start
错误1:
-- Could NOT find Git (missing: GIT_EXECUTABLE) -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
解决:
-- Could NOT find Git (missing: GIT_EXECUTABLE)这项应该缺少git包,yum install -y git
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown 这两项缺少gcc和gcc-c++的包,yum install -y gcc gcc-c++
错误2:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:85 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:128 (FIND_CURSES) cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE) CMakeLists.txt:409 (MYSQL_CHECK_EDITLINE) -- Configuring incomplete, errors occurred!
解决:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
缺少ncurses-devel包,yum install -y ncurses-devel
删除CMakeCache.txt
file=find / -name CMakeCache.txt
rm -f $file
错误3:
Warning: Bison executable not found in PATH
解决:
Warning: Bison executable not found in PATH 缺少Bison,yum install -y bison
错误4:
CMake Error: Internal CMake error, TryCompile configure of cmake faile
解决:
没有安装openssl的开发包,安装下openssl-devel类似的,yum install -y openssl-devel
错误5:
Googlemock was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source. — If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
解决:
使用参数-DENABLE_DOWNLOADS=1 自动下载。
有网络限制,设置http代理export http_proxy=http://example.com:80。环境变量http_proxy 也为 curl 等其他工具所用。尽管 yum 可以识别大写或小写的 http_proxy,但curl 要求环境变量的名称是小写。