Skip to content

Instantly share code, notes, and snippets.

@Mouad-BGD
Created June 4, 2012 13:19
Show Gist options
  • Select an option

  • Save Mouad-BGD/2868323 to your computer and use it in GitHub Desktop.

Select an option

Save Mouad-BGD/2868323 to your computer and use it in GitHub Desktop.
LAMP server
Always remeber those paths:
* PHP Paths (php.ini path)
* Apache paths and Loaded Modules (mod_security, mod_evasive if installed_
* PHP GD Library
* MySQL paths and other information gedit /etc/mysql/my.cnf
Config files:
+++++++++++++
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/phpmyadmin.conf
/etc/php.ini
php
---
/etc/php.ini
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
error_log = /var/log/php.log
max_execution_time = 300
memory_limit = 64M
register_globals = Off
MySQL errors
-------------
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
start mysql deamon
phpMyAdmin
----------
Forbidden
You donEdit the /etc/httpd/conf.d/phpmyadmin.conf and uncomment the line deny from all.
nano /etc/httpd/conf.d/phpmyadmin.conf
<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
# Deny from all
Allow from 127.0.0.1
</Directory>'t have permission to access /phpmyadmin/ on this server.
Error
The configuration file now needs a secret passphrase (blowfish_secret)
nano /usr/share/phpmyadmin/conf.inc.php
Look for a line and enter any password. Just dont leave it empty!
$cfg['blowfish_secret'] = 'mydemopass'; /* YOU MU
Apache
------
config file: /etc/httpd/conf/httpd.conf
su
yum install httpd httpd-devel
/etc/init.d/httpd start
MySQL
-----
yum install mysql mysql-server mysql-devel
/etc/init.d/mysqld start /* start the mysql server and create ‘/var/lib/mysql/mysql.sock’ */
mysql /* testing */
Step 2 (optional only if needed). In order for other computers on your network to view the server you have created, you must first edit the "Bind Address". Begin by opening up Terminal to edit the my.cnf file.
Configuration
+++++++++++++
Script way (recomeneded)
**********
mysql_secure_installation
t's recommended that you run mysql_secure_installation, a program that helps secure MySQL. While running mysql_secure_installation, you will be presented with the opportunity to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options. If you are prompted to reload the privilege tables, select yes.
for more info in securing mysql:http://www.symantec.com/connect/articles/securing-mysql-step-step
manual way
**********
Set Root password
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;
Testing
mysql -u root -p
Enter Password: <your new password>
create a new mysql user 'guest' with 'all privileges' on the database 'demo':
mysql > create database demo
mysql >GRANT ALL PRIVILEGES ON demo.* TO 'guest'@'localhost' IDENTIFIED BY 'guest' WITH GRANT OPTION;
mysql> UPDATE user SET Password=PASSWORD('guest') WHERE user='guest';
PHP
---
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd restart
create a file for testing: /var/www/html/test.php >> <?php phpinfo() ?>
phpMyAdmin
-----------
yum install phpmyadmin
http://ip.address/phpmyadmin /* test */
Install Webmin
---------------
wget <webmin rpm path>
rpm - ivh webmin-1.410-1.noarch.rpm
Point your browser to: http://ip.address:10000
create password:
/usr/libexec/webmin/changepass.pl /etc/webmin admin <newpasswd>
Auto-Start
----------
/sbin/chkconfig --levels 235 httpld on
/sbin/chkconfig --levels 235 mysqld on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment