CentOS源码LAMP是一种基于CentOS操作系统的开源解决方案,用于搭建Web服务器、数据库和PHP运行环境。
要在 CentOS 上安装 LAMP(Linux, Apache, MySQL, PHP)源码,你需要按照以下步骤操作:
1、更新系统并安装必要的依赖包:
sudo yum update y sudo yum install y gcc make autoconf libtool pkgconfig gccc++ openssldevel pcredevel zlibdevel
2、安装 Apache:
下载 Apache 源码 wget https://archive.apache.org/dist/httpd/httpd2.4.53.tar.gz tar zxvf httpd2.4.53.tar.gz cd httpd2.4.53 配置并编译安装 ./configure prefix=/usr/local/apache2 enableso enablerewrite withmpm=prefork withincludedapr withincludedaprutil enablessl enabledeflate enableproxy enableproxyconnect enableproxyftp enableproxyhttp enableproxyajp enableproxybalancer enablecache enablediskcache enablefilecache enablememcache enableexpires enableheaders enableusertrack enablesession enableuniqueid enablecasefilter enablecaseescaping enableauthncore enableauthnfile enableauthzcore enableauthzhost enableauthzuser enableauthzdefault enableauthzowner enableauthzgroupfile enableauthzdbm enableauthzexternal enableauthndbm enableauthnanon enableauthndbd enableauthndigest enableauthnalias enableauthnhtpasswd enableauthnhtdigest enableauthnbasic enablelogrotate enablesetenvif enablemimemagic enablecgi enablecgid enablesuexec enablelua withsuexectype=socket withsuexecbin=/usr/local/apache2/bin/suexec2 withsuexeccaller=apache withsuexecdocroot=/var/www withsuexecuidmin=1000 withsuexecgidmin=1000 withsuexecumask=077 withsuexeclogfile=/var/log/apache2/suexec_log make && sudo make install
3、安装 MySQL:
下载 MySQL 源码 wget https://dev.mysql.com/get/Downloads/MySQL8.0/mysql8.0.26.tar.gz tar zxvf mysql8.0.26.tar.gz cd mysql8.0.26 配置并编译安装 cmake . DCMAKE_INSTALL_PREFIX=/usr/local/mysql DWITH_BOOST=boost DWITH_SYSTEMD=1 DWITH_INNOBASE_STORAGE_ENGINE=1 DWITH_PARTITION_STORAGE_ENGINE=1 DWITH_FEDERATED_STORAGE_ENGINE=1 DWITH_BLACKHOLE_STORAGE_ENGINE=1 DWITH_MYISAM_STORAGE_ENGINE=1 DENABLED_LOCAL_INFILE=1 DENABLE_DTRACE=0 DDEFAULT_CHARSET=utf8mb4 DDEFAULT_COLLATION=utf8mb4_general_ci DWITH_EMBEDDED_SERVER=OFF DENABLE_DOWNLOADS=ON DWITH_SSL=system DWITH_ZLIB=system DWITH_LIBWRAP=0 DMYSQL_UNIX_ADDR=/tmp/mysql.sock DWITH_EXTRA_CHARSETS=all DWITH_DEBUG=0 DWITH_READLINE=ON DWITH_LIBEDIT=OFF DWITH_ARCHIVE_STORAGE_ENGINE=1 DWITH_BLACKHOLE_STORAGE_ENGINE=1 DWITH_INNOBASE_STORAGE_ENGINE=1 DWITH_PARTITION_STORAGE_ENGINE=1 DWITH_FEDERATED_STORAGE_ENGINE=1 DWITH_PERFSCHEMA_STORAGE_ENGINE=1 DWITHOUT_TOKUDB_STORAGE_ENGINE=1 DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 DWITHOUT_PLUGIN_STORAGE_ENGINE=1 DWITHOUT_SPHINX_STORAGE_ENGINE=1 DWITHOUT_TOKUDB_STORAGE_ENGINE=1 DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 DWITHOUT_PLUGIN_STORAGE_ENGINE=1 DWITHOUT_SPHINX_STORAGE_ENGINE=1 make && sudo make install
4、安装 PHP:
下载 PHP 源码 wget https://www.php.net/distributions/php7.4.19.tar.gz tar zxvf php7.4.19.tar.gz cd php7.4.19 配置并编译安装 ./configure prefix=/usr/local/php withconfigfilepath=/usr/local/php/etc withconfigfilescandir=/usr/local/php/etc/conf.d withopenssl withzlib withcurl withlibxmldir enablembstring withfreetypedir withjpegdir withpngdir withgd withwebpdir withxpmdir withtiffdir withmysqli=mysqlnd withpdomysql=mysqlnd withmysqlsock=/tmp/mysql.sock withpear enablefpm withfpmuser=apache withfpmgroup=apache enableopcache enableexif enablezip enablecalendar enablebcmath enableintl enablesoap enablepcntl enableftp enablesockets enablesysvmsg enablesysvsem enablesysvshm enableshmop enablepcntl enablemaintainerzts make && sudo make install
5、配置 Apache、MySQL 和 PHP:
创建软链接 sudo ln s /usr/local/php/bin/php /usr/bin/php sudo ln s /usr/local/php/sbin/phpfpm /usr/sbin/phpfpm sudo ln s /usr/local/php/etc/php.ini /etc/php.ini sudo ln s /usr/local/php/etc/phpfpm.conf /etc/phpfpm.conf sudo ln s /usr/local/php/etc/phpfpm.d /etc/phpfpm.d 复制配置文件 sudo cp /usr/local/apache2/conf/httpd.conf /etc/httpd/conf/httpd.conf sudo cp /usr/local/apache2/conf.d/* /etc/httpd/conf.d/ sudo cp /usr/local/mysql/supportfiles/mydefault.cnf /etc/my.cnf 启动服务 sudo systemctl start httpd sudo systemctl start mysqld sudo systemctl start phpfpm 设置开机启动 sudo systemctl enable httpd sudo systemctl enable mysqld sudo systemctl enable phpfpm
你已经成功安装了 LAMP 源码,你可以通过访问http://your_server_ip
来检查是否正常运行。
小伙伴们,上文介绍了“centos 源码lamp”的内容,你了解清楚吗?希望对你有所帮助,任何问题可以给我留言,让我们下期再见吧。
原创文章,作者:未希,如若转载,请注明出处:https://www.kdun.com/ask/1166557.html
本网站发布或转载的文章及图片均来自网络,其原创性以及文中表达的观点和判断不代表本网站。如有问题,请联系客服处理。
发表回复