Thursday, May 3, 2018

Ubuntu important commands

lastb only shows login failures. Use last to see successful logins.



Check if package is install or not

dpkg --list | grep phpmyadmin




How to keep processes running after ending ssh session?
  • ssh into your remote box. Type screen Then start the process you want.
  • Press Ctrl-A then Ctrl-D. This will "detach" your screen session but leave your processes running. You can now log out of the remote box.
  • If you want to come back later, log on again and type screen -r This will "resume" your screen session, and you can see the output of your process.
OR use 
sudo aptitude install byobu
Start byobu by typing byobu.
Press 
F2 to create a new window within the current session, 
F3-F4 to switch between the various windows.
F6 (detach) to leave byobu and keeep it running .




Get Installation directory 
whereis tomcat7

Compress Folder and save it as a file in current directory
tar -zcvf FileName.tar.gz -C /Folder/Name/To/Compress   .

Extract Compressed File
tar zxf solr-7.0.0.tgz


Install PHP version 5.6
------------------------------
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php5.6

Un-Install PHP 7
-----------------------
sudo apt-get purge php7.0-common
sudo apt-get purge php7.*


Install JDK 8.0
-------------------
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

#Setup JAVA_HOME and JRE_HOME Variable
nano /etc/environment
JAVA_HOME=/usr/lib/jvm/java-8-oracle
JRE_HOME=/usr/lib/jvm/java-8-oracle/jre


Install Apache2
---------------------
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2 apache2-doc apache2-utils


Install MySQL
-------------------
sudo apt-get update
sudo apt-get install mysql-client-core-5.5
sudo apt-get install mysql-server-5.5
sudo mysql_secure_installation

Un-Install MySQL
----------------------
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/init.d/mysql
sudo rm -rf /etc/init/mysql.conf




Login to Mysql, create DB, Import Backup, Create user, and add PRIVILEGES
-------------------------------------------------------------------------------------------------------
mysql -u root -p


CREATE ___my_database_name____ CHARACTER SET utf8 COLLATE utf8_general_ci;

mysql -u root -p ddl < /root/backupFile.sql
CREATE USER 'xxxx'@'localhost' IDENTIFIED BY 'Password';
GRANT ALL ON DatabaseName.* TO 'xxx'@'localhost';

CREATE USER 'xxxx'@'127.0.0.1' IDENTIFIED BY 'Password';
GRANT ALL ON DatabaseName.* TO 'xxx'@'127.0.0.1';

CREATE USER 'root'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

FLUSH PRIVILEGES;




No comments: