首先,安装依赖包并下载Nginx、MySQL和PHP源码。然后分别编译安装它们,最后配置环境变量。
安装编译环境
1、更新系统软件包
yum update y
2、安装依赖库和工具
yum install gcc gccc++ make zlibdevel pcredevel openssldevel y
3、下载并解压Nginx、MySQL和PHP源码包
wget http://nginx.org/download/nginx1.6.2.tar.gz wget https://dev.mysql.com/get/Downloads/MySQL5.6/mysql5.6.21.tar.gz wget http://www.php.net/distributions/php5.6.3.tar.gz
4、创建编译目录并进入
mkdir nginx mysql php cd nginx
编译安装Nginx
1、解压源码包
tar zxvf nginx1.6.2.tar.gz
2、配置并编译
cd nginx1.6.2 ./configure prefix=/usr/local/nginx withhttp_stub_status_module withhttp_ssl_module withpcre=/usr/local/src/pcre8.37 withopenssl=/usr/local/src/openssl1.0.1e make && make install
3、启动Nginx并设置开机自启动
/usr/local/nginx/sbin/nginx chkconfig nginx on
编译安装MySQL
1、解压源码包
cd ../mysql tar zxvf mysql5.6.21.tar.gz
2、安装依赖库和工具
cd mysql5.6.21 yum install ncursesdevel y
3、配置并编译
cd mysql5.6.21 cmake . DCMAKE_INSTALL_PREFIX=/usr/local/mysql DWITH_INNOBASE_STORAGE_ENGINE=1 DWITH_ARCHIVE_STORAGE_ENGINE=1 DWITH_BLACKHOLE_STORAGE_ENGINE=1 DWITH_READLINE=1 DWITH_SSL=system DWITH_ZLIB=system DWITH_LIBWRAP=0 DMYSQL_DATADIR=/usr/local/mysql/data DSYSCONFDIR=/etc DWITH_TCP_PORT=3306 DDEFAULT_CHARSET=utf8mb4 DDEFAULT_COLLATION=utf8mb4_general_ci DWITH_EXTRA_CHARSETS=all DWITH_DEBUG=0 DWITH_EMBEDDED_SERVER=OFF DENABLED_LOCAL_INFILE=1 DENABLED_PROFILER=0 DENABLED_DEBUG_SYNC=0 DENABLED_DEBUG_SYNC_MODE=OFF DENABLED_PSALM=0 DENABLED_PSALM_TESTS=0 DENABLED_STATISTICS=0 DENABLED_PROFILING=0 DENABLED_TRACE=0 DENABLED_STMT_COUNT=0 DENABLED_DEBUG_LOG=0 DENABLED_GEOMETRY=OFF DENABLED_AUTOCOMMIT=OFF DENABLED_LOAD=OFF DENABLED_TIMESTAMPS=OFF DENABLED_OCI8=OFF DENABLED_SPATIAL=OFF DENABLED_REPLICATION=OFF DENABLED_SSL=system DWITH_SSLDIR=/usr/local/ssl DFEATURE_PLUGIN_AUTHENTICATION=OFF DFEATURE_PLUGIN_AUTHENTICATION_METHOD=SHA256_PASSWORD DFEATURE_FEDERATEDX509=ON DFEATURE_GSSAPI=OFF DFEATURE_GROUPCONCAT=OFF DFEATURE_NDBCLUSTER=OFF DFEATURE_REGEXP=ON DFEATURE_STACKDRIVER=OFF DFEATURE_EVENTS=OFF DFEATURE_XMLPARSER=ON DFEATURE_MAXEXECUTIONTIME=OFF DFEATURE_HELP=OFF DFEATURE_REOPENTABLES=OFF DFEATURE_PROCESSLISTACCESSIBILITY=OFF DFEATURE_UNBUFFEREDQUERIES=OFF DFEATURE_UPDATESTATISTICS=OFF DFEATURE_CHECKSUMAGGREGATION=OFF DFEATURE_MERGECONSTANTS=OFF DFEATURE_ALLOWUSERSWITCHING=OFF DFEATURE_MULTIRESULTSETS=OFF DFEATURE_SEQUENCETABLESTATUSBYTES=OFF DFEATURE_FOREIGNKEYCHECKS=ON DFEATUREBACKSLASHNOTNULL=ON DFEATURECANNOTIMPLEMENTLOCKINGBYTECODE=ON DFEATUREDISABLECONNECTBYLOCATOR=ON DFEATUREDONTUSETEMPTABLESFORCONNECT=ON DFEATUREHAVEGEOMETRYINDEX=OFF DFEATUREISNOTNULLAUTOINCREMENTALLWAYSINSERT = ON DFEATURELONGVARBINARYLITERALS = ON DFEATUREREPLICATIONROLLBACK = ON DFEATURESECURITYFUNCTIONS = ON DFEATURESELECTIVEINDEXSCAN = ON DFEATURESIMPLIFYINGLOOKUP = ON DFEATURESNAPSHOT = ON DFEATURESTMTPREPARATIONAREASIZE = ON DFEATURETWODATETIMEDIFFERENTPARAMTYPES = ON DFEATUREUTCDATETIME = ON DFEATUREVALIDATEUTF8MB4STRING = ON DEFINES+=DHAVE__STRICT_ANSI__="" CXXFLAGS="g" CFLAGS="g" LDFLAGS="" OBJS="sql/sql_class.o sql/sql_const.o sql/sql_dictionary.o sql/sql_error.o sql/sql_field.o sql/sql_index.o sql/sql_item.o sql/sql_list.o sql/sql_metadata.o sql/sql_optimizer.o sql/sql_parse.o sql/sql_partitioning.o sql/sql_prepared.o sql/sql_queue.o sql/sql_records.o sql/sql_select.o sql/sql_servers.o sql/sql_statistics.o sql/sql_string.o sql/sql_tables.o sql/sql_transactions.o sql/sql_triggers.o sql/sqlddl.o storage/ha?dodah\?daemon\?storage\?engine?impl\?myisam?base\?imp\?ossp\?ha\?dodah\?daemon\?storage\?engine\?impl?myisam\?base?imp\?minimal\?myisam\?storage\?engine\?impl\?heap?imp\?bdb\?storage\?engine\?impl?innobase\?storage?engine\?impl\?myisam\?storage\?engine\?impl\?ndbcluster\?storage\?engine\?impl datatypes/datetime\?datatype\?impl handlers/blob\?handler datatypes/year?datatype\?impl handlers/json\?handler storage/adaptive\?hash\?index datatypes/json\?datatype\?impl storage/ndbinfo storage/ndbclient datatypes/event\?datatype\?impl storage/examples storage/examples\?plugin system tables sys schema files include scripts cmakefiles Makefile" make && make install
4、初始化数据库
cd /usr/local/mysql scripts/mysql_install_db user=mysql basedir="$(pwd)" datadir="$(pwd)/data" pidfile="$(pwd)/data/mysqld.pid" socket="/tmp/mysqld.sock" port=3306 skiptestdb force defaultauthenticationplugin=sha256 password "yourpassword" initializeinsecure user='mysql' basedir='$(pwd)
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/518577.html