Created
October 23, 2013 21:31
-
-
Save rrubiorr81/7127132 to your computer and use it in GitHub Desktop.
notes lamp course, virtual box
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#logging into the ubuntu server... | |
ssh -lusername -pporttouse hostname | |
ssh -lrichard -p2222 sandbox.dev //practical example... | |
sudo apt-get update // downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies. It will do this for all repositories and PPAs | |
sudo apt-get -y upgrade //apt-get upgrade will fetch new versions of packages existing on the machine | |
// the -y stands for saying yes to all dialogs | |
//installing the needed packages for the communication btw the host and the server... | |
sudo apt-get -q -y install build-essential module-assistant linux-headers-$(uname -r) dkms zip unzip | |
//APT | |
/*Necesitaban una manera rápida, práctica y eficiente de instalar paquetes, que pudiera manejar dependencias automáticamente y cuidara los archivos de configuración al actualizar. De nuevo, Debian condujo la marcha y nació APT, la “Herramienta Avanzada de Paquetes” (Advanced Packaging Tool), que desde entonces ha sido portada por Conectiva para usarse con rpm y adoptada por otras distribuciones. */ | |
//mounting image | |
sudo mount /dev/cdrom /media/cdrom | |
//VirtualBox Guest Additions installer the --nox11 flag means dont install anything on windows | |
sudo sh /media/cdrom/VBoxLinuxAdditions.run --nox11 | |
//adding u r user to the group of the virtualbox account... | |
sudo usermod -a -G vboxsf richard | |
sudo usermod -a -G vboxsf www-data | |
//activating the friendly url in apache... | |
sudo a2enmod rewrite | |
//where is the shared folder and what domain to use.. this will define the name of the site on the url... | |
sudo nano -w /etc/apache2/sites-available/sandbox //written... | |
//enabeling the apache configuration... | |
sudo a2ensite sandbox //sandbox is the name of the new site... | |
//specifying the server name in the apache configuration... | |
sudo nano -w /etc/apache2/httpd.conf | |
//editing php to log errors (php.ini) | |
sudo nano -w /etc/php5/apache2/php.ini | |
//changing the php.ini for production environment.. | |
error_reporting = E_ALL | E_STRICT //just for production env | |
display_errors = On //by default in Off | |
log_errors = On | |
log_errors_max_len = 0 // by default in 1024... 0 means it has no limits... | |
error_log = /media/sf_sandbox/php_errors.logging // new line... logging into a fixed folder.. | |
//telling the MySQL server where to listen for connections... | |
sudo nano -w /etc/mysql/my.cnf | |
//search for bind-address, change it to 0.0.0.0.. by default is in 127.0.0.1, listenign to localhost, with the change we will start listening to all connection, this is unsecure, but for dev servers like this is fine. | |
//installing and configuroing exim4, a free and simple mail server... | |
sudo apt-get -y install exim4 | |
//configuring | |
sudo dpkg-reconfigure exim4-config | |
mail sent by smarthost; received from via SMTP or fetchmail | |
--ip addresses to listen to for incoming SMTP connections | |
--outgoing smarthost servers smtp.gmail.com::587 | |
//entering the auth data in mail server... | |
sudo nano -w /etc/exim4/passwd.client | |
//filling passwd.client | |
*:[email protected]:password | |
//rebooting the server | |
sudo reboot | |
//installing phpmyadmin | |
sudo apt-get -y install phpmyadmin | |
//configuring phpmyadmin to automaticaly log-in | |
sudo nano -w /etc/phpmyadmin/config.inc.php | |
//search for the authentication method: $cfg['Servers'][$i]['auth_type'] = 'cookie' --> 'config' | |
//add two lines $cfg['Servers'][$i]['user'] = 'root' | |
//add two lines $cfg['Servers'][$i]['password'] = 'root' | |
/**/ | |
//u have to add the inclusion of phpmyadmin in the apache.conf | |
Include /etc/phpmyadmin/apache.conf //anywhere in -- /etc/apache2/apache2.conf | |
//and finally restart apache. | |
/etc/init.d/apache2 restart | |
//the system in this example has been configured to read from the shared fodler in the host | |
//system (windows) and copy it in the nested system VM (ubuntu) | |
//this is known as shared folder... | |
//it can be stablished in VirtualBox->settings->shared folders | |
C:\Tuto\LAMP\sandbox --> /media/sf_sandbox | |
//installing wordpress | |
//in the shared folder | |
wget http://wordpress.org/wordpress-3.3.2.zip | |
unzip wordpress-3.3.2.zip | |
//in the browser | |
localhost:8080/wordpress/wp-admin/install.php | |
//restarting apache... | |
sudo service apache2 restart | |
//troubleshooting in apache2... //go to /var/log/apache2/ -- there u can find the log related to that site... | |
//filtering on the result to show on the ls command | |
>ls -la sandbox.* //shows all entries with the sandbox head in that directory... | |
--there are usually two files.. 1 for the access and the other for the errors.. | |
tail -f sandbox.dev-access.log | |
//conexiones activas de una computadora -- -nap: data output flags | |
sudo netstat -nap | grep apache //the connections apache is listening to... | |
sudo netstat -nap | grep :80 //looking for conflicting services on the same port... if u see more than one, u may have a conflict. | |
//troublehoosting MySQL | |
//opning the mysql configuration file... | |
sudo nano -w /etc/mysql/my.cnf | |
//adding the following line for error reporting in mysql... down the [mysqld] tag | |
log-error=/var/log/mysql/mysql-error.log | |
//the following line will log everything, so is going to slow down the system.. only use on troublehoosting... | |
log=/var/log/mysql/mysql.log | |
//long query duration | |
long_query_time=1 | |
//slow queries | |
log-slow-queries=/var/log/mysql/slow-queries.log | |
//optimizating the system... | |
log-queries-not-using-indexes | |
//after all this changes restart the service | |
sudo service mysql restart //or | |
sudo service mysql stop | |
sudo service mysql start | |
//inspecting for changes in the logs | |
tail -f /var/log/mysql/mysql.log | |
// | |
ps aux | grep mysql | |
//accessing to the mysql server as a client | |
mysql -uroot -proot | |
mysql> show databases; //example to run inside the mysql command line... | |
//if mysql is running but u can not connect to it, see if its running in the port 3306 | |
sudo netstat -nap | grep mysql | |
//troublehoosting PHP | |
php -v /*its the same than*/ php --version | |
php -i /*its the same than*/ php --info | |
//there are two configs for php... one that apache uses for the browser, and the other used in the command line (CLI) | |
//log files are commonly in /var/log/ | |
//in VirtualBox apparently u can not use symbolic links so u have to copy the whole folder recursivly | |
cp -R /path/to/folder/to/copy /path/to/new/location/ | |
//installing webmin to monitor u r server | |
sudo apt-get install -y perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python | |
//downloading the webmin package perse | |
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.580_all.deb | |
//installing the just downloaded file | |
sudo dpkg --install webmin_1.580_all.deb | |
//by default webmin uses SSL, however as the certificate provided by is self-signed, some browser will not accept it... | |
sudo nano -w /etc/webmin/miniserv.conf //here just change the ssl flag from 1 to 0... | |
//restarting webmin | |
sudo /etc/init.d/webmin restart | |
//webmin runs on a non-standart port... u will have to forward it to be able to access it. | |
//enter virtualbox and in network add a new port forwarding, add a new rule. Webmin 10000 for both guest and host. | |
http://localhost:10000/ | |
/*having problems*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment