Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS's method of using Local yum Source to build LAMP Environment

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today Xiaobian to share with you CentOS using local yum source to build LAMP environment related knowledge points, detailed content, clear logic, I believe most people still know too much about this knowledge, so share this article for everyone to refer to, I hope you read this article after harvest, let's learn about it together.

[Preparations]

Configure firewall, open port 80 and port 3306

vi /etc/sysconfig/iptables

As shown in the figure, add the following two items:

-a input -m state --state new -m tcp -p tcp --dport 80 -j accept #Allow port 80 through firewall-a input -m state --state new -m tcp -p tcp --dport 3306 -j accept #Allow port 3306 through firewall

Restart firewall to make configuration take effect

/etc/init.d/iptables restart

Close selinux

vi /etc/selinux/config#selinux=enforcing #comment out #selinuxtype=targeted #comment out selinux=disabled #add:wq! #Save Exit

restart the system

shutdown -r now

Install Apache

perform the installation

yum -y install httpd

start Apache

service httpd restart

Or:

/etc/init.d/httpd start

Apache could not reliably determine the server's fully qualifdomain name, using ::1 for servername

vi /etc/httpd/conf/httpd.conf

Find #servername www.example.com:80

Modify to servername www.lws.com:80 (set to own domain name or servername localhost:80)

:wq!# save and exit

Set to boot

chkconfig httpd on

Check the installation access host address as shown in the figure. Installation is successful

Modify apache configuration

vi /etc/httpd/conf/httpd.conf #It is recommended to make a backup before using ftp tool to modify

Amend as follows:

servertokens os #on line 44 modified to: servertokens prod (Do not display the name of the server operating system when the error page appears) serversignature on #Modified to: serversignature off at line 536 options indexes followsymlinks #on line 331 changed to: options includes execcgi followsymlinks #addhandler cgi-script .cgi #modified to: addhandler cgi-script.cgi .pl on line 796 (Allow cgi scripts with extension.pl to run) allowoverride none #modified to: allowoverride all on line 338 (Allow.htaccess) adddefaultcharset utf-8 #modified to read: adddefaultcharset gb2312 (gb2312 added as default) options indexes multiviews followsymlinks #modified to options multiviews followsymlinks on line 554 (Not displaying tree structure in browser) directoryindex.html index.html.var #modified to: directoryindex.html index.htm default.html index.php default.phpindex.html.var on line 402 (Set default home page file, add index.php) keepalive off #in line 76 modified to: keepalive on (allow programmatic connection) maxkeepaliverequests 100 #in line 83 modified to: maxkeepaliverequests1000 (increase the number of simultaneous connections)

Remove two default test pages

rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html

restart Apache

service httpd restart

or

/etc/init.d/httpd restart

[Install mysql]

perform the installation

yum -y install mysql mysql-server

start the MySQL

/etc/init.d/mysqld start

Set to boot

chkconfig mysqld on

Copy the configuration file (Note: If there is a my.cnf by default under the/etc directory, you can overwrite it directly)

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

Set password for root account

mysql_secure_installation#Enter, enter y according to prompt, enter password twice, enter, enter y all the way according to prompt, and finally appear: thanks for using mysql

or

mysqladmin -u root password 'password'

Allow remote login

mysql -u root -p

enter the password

Enter the mysql command:

grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;

exit mysql: exit

restart MySQL

service mysqld restart

Install php5

perform the installation

yum -y install php

Install php components (here select the following installation package, enter y to install according to the prompt)

The copy code is as follows:

yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

Modify php configuration

vi/etc/php.ini #It is recommended to make a backup before modifying it with ftp tool

Amend as follows:

date.timezone= prc #Remove the semicolon at line 946 and change it to date.timezone = prc

The copy code is as follows:

disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin, posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid, posix_getpwnam,posix_getpwuid, posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid, posix_setsid,posix_setuid,posix_streror,posix_times,posix_ttyname,posix_uname #List the functions that php can disable in line 386. If some programs need this function, you can delete it and undisable it.

expose_php = off #Disable php version information on line 432 magic_quotes_gpc = on #Open magic_quotes_gpc on line 745 to prevent sql injection short_open_tag = on #Support php short tag open_basedir = .:/on line 229 tmp/#is set in line 380 to allow access to the current directory (that is, the directory where the php script file is located) and/tmp/directory, which can prevent php Trojans from crossing sites. If there is a problem with installing the program after changing it, you can log off this line, or write directly to the program directory/data/www.osyunwei.com/:/tmp/

Restart mysql, apahe

service mysqld restartservice httpd restart

(This completes the yum source lamp environment, we can check the installation version of each part)

View Apache version

httpd -v

View php version

php -v

Check out the MySQL version

mysql -v

(Note Capitals)

The above is "CentOS uses local yum source to build LAMP environment" all the content of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report