Skip to content

Instantly share code, notes, and snippets.

@weiofcn
Last active January 11, 2018 03:32
Show Gist options
  • Save weiofcn/f113a6d2875654cbddfa4a85c3f8d1b7 to your computer and use it in GitHub Desktop.
Save weiofcn/f113a6d2875654cbddfa4a85c3f8d1b7 to your computer and use it in GitHub Desktop.
安装REDIS、MONGODB和MARIADB服务端和C/C++下面的开发环境

安装REDIS、MONGODB和MARIADB服务端和C/C++下面的开发环境

REDIS

  1. 服务端安装:apt install redis-server
  2. 下载C/C++开发库:https://github.com/redis/hiredis/releases
  3. 编译C/C++开发库:make && make install
  4. 编译运用程序:gcc -o example example.c $(pkg-config --libs --cflags hiredis)

MONGODB

  1. 服务端安装:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
  2. 下载C/C++开发库:https://github.com/mongodb/mongo-c-driver/releases
  3. 编译C/C++开发库:./configure && make && make install
  4. 编译运用程序:gcc -o hello_mongoc hello_mongoc.c $(pkg-config --libs --cflags libmongoc-1.0)

MARIADB

  1. 服务端安装:https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna
  2. 安装相关库:apt install mariadb-server mariadb-client libmariadbclient-dev libmariadbd-dev phpmyadmin
  3. 下载C/C++开发库:https://github.com/MariaDB/mariadb-connector-c/releases
  4. 编译C/C++开发库:cmake . && make && make install
  5. 编译运用程序:gcc main.c -o main $(mysql_config --libs --cflags)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment