Last active
April 24, 2018 15:59
-
-
Save adityatelange/993c9ffc2561b4cbdf989429ffd28468 to your computer and use it in GitHub Desktop.
Raspberry pi 3 Cheat Sheet
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
sudo su | |
sudo !! | |
clear {clear the console window} | |
apt-get update {updating sources list} | |
apt-get upgrade {upgrading the sources} | |
apt-get install | |
man {manual} | |
help {help docs} | |
find {searches a directory and subdirectories} | |
nano textfilename.txt | |
ls {listing contents in dir} | |
cp ~/some_dir/file1 ~/some_dir2/file2 {copies file1 to /somedir_2/ as filename='file2'} | |
mkdir dirname {making new directory/folder} | |
rmdir dirname {deleting the directory permanantly CAUTION!} | |
ifconfig {network conguration} | |
wget address_to_file/filename.extention {downloads the file 'filename.extention' from the web and saves it to the current directory} | |
lsusb {list usb devices} | |
CHMOD {to change the permissions for a file} | |
SSH {secure shell} | |
curl {to download or upload a file to/from a server} | |
ping webaddress {check connection with 'webaddress} [ex. ping www.google.co.uk] | |
reboot now {rebooting immediately} | |
shutdown -h now {shutdown immediately} | |
sudo apt-get install rpi-update {get the latest firmware for your Raspberry Pi} | |
raspi-config {Raspberry Pi configuration tool} [https://www.raspberrypi.org/documentation/configuration/raspi-config.md] | |
apt-get install tightvncserver {installing vnc} | |
tightvncserver {starting vnc} |
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
In cmdline.txt (changed the following in the boot partition from both, SD-card and USB stick.) { | |
root=/dev/[sdcard] | |
to | |
root=/dev/[usbstick] | |
} | |
In config.txt (add the following) { | |
program_usb_boot_mode=1 | |
} |
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
### UPDATING DATE AND TIME ### | |
sudo apt-get install ntp | |
try this: | |
sudo /etc/init.d/ntp stop | |
sudo /etc/init.d/ntp start | |
If not with | |
sudo /etc/init.d/ntp stop | |
sudo ntpd -q-g | |
sudo /etc/init.d/ntp start | |
### SET DATE MANUALLY ### | |
sudo date -s "Fri Feb 2 20:25:00 IST 2018" |
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
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
sudo apt-get dist-upgrade -y | |
sudo apt-get install -y rpi-update | |
sudo apt-get install apache2 -y | |
sudo apt-get install -y php7.0-fpm php7.0-curl php7.0-gd php7.0-cli php7.0-mcrypt php7.0 php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip php7.0-mysql php7.0-json libapache2-mod-php7.0 php7.0-imap php7.0-xmlrpc libapache2-mod-php7* php7.0-cli php-mbstring php-gettext | |
sudo apt-get install mysql-server -y | |
sudo mysql_secure_installation | |
sudo apt-get install -y python-mysqldb python3-mysqldb | |
sudo mysql -u root -p | |
GRANT ALL PRIVILEGES ON mydb.* TO 'username'@'localhost' IDENTIFIED BY 'password'; | |
##enter username as 'whateveryouwant' password as 'whaterverpassword'## | |
sudo apt-get install phpmyadmin -y | |
sudo nano /etc/apache2/apache2.conf | |
##Enter the following at the bottom of this file 'apache2.conf': | |
## Include /etc/phpmyadmin/apache.conf | |
sudo /etc/init.d/apache2 restart | |
### for securing server ### | |
sudo apt-get install fail2ban |
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
SSL Proxy Configuration | |
### STEPS ### | |
# sudo mkdir /etc/apache2/ssl | |
# sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key | |
# Enable Apache2 Modules for Proxying & SSL | |
# sudo a2enmod proxy | |
# sudo a2enmod proxy_http | |
# sudo a2enmod ssl | |
# sudo ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl | |
# sudo ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/000-default-ssl.conf | |
# sudo nano /etc/apache2/sites-enabled/000-default-ssl.conf | |
# Change the two lines relative to SSLCertificate as follow (/etc/apache2/sites-enabled/000-default-ssl) | |
SSLCertificateFile /etc/apache2/ssl/server.crt | |
SSLCertificateKeyFile /etc/apache2/ssl/server.key | |
### Restart Apache ### | |
sudo systemctl restart apache2 |
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
# add the Webmin repository to your sources.list file. | |
sudo nano /etc/apt/sources.list | |
# add following lines at the end of file (goto end of file press ctrl-v) | |
deb http://download.webmin.com/download/repository sarge contrib | |
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib | |
# add the Webmin GPG key to apt | |
wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add - | |
# update the sources | |
sudo apt-get update | |
# install webmin | |
sudo apt-get install webmin -y | |
# Webmin is now running on: | |
https://rpi.local:10000 | |
# Login to webmin using username and password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment