Skip to content

Instantly share code, notes, and snippets.

@saumya
Last active April 26, 2017 06:45
Show Gist options
  • Save saumya/acfb66f94b12d8c8df0b59d416ca5f72 to your computer and use it in GitHub Desktop.
Save saumya/acfb66f94b12d8c8df0b59d416ca5f72 to your computer and use it in GitHub Desktop.
Ubuntu setup and tricks
# Installation and some details
==================================================================================
If android is installed with Android Studio then the path to sdk is at
` ~/Android/sdk/ `
==================================================================================
## NodeJS :
ref: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
==================================================================================
Version 7.x
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
==================================================================================
==================================================================================
Version 6.x
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
==================================================================================
[Permission settings reference](https://saumya.github.io/ray/articles/70/)
The default location of `nodejs` and `node_modules` is at `/usr/lib`
View permissions
```
ls -la /usr/lib/node_modules
```
Change permission to current user in this case it is setting as `iAmCurrent` :)
```
id -u root
id -u <username>
```
Change permission of `node_modules` but not the whole `lib`. If you change the permission of `lib`, your linux install will be at risk. So be careful.
```
sudo chown -R iAmCurrent /usr/lib/node_modules/
sudo chown -R root /usr/lib/node_modules/
```
## Installing a .deb file :
===============
sudo dpkg -i DEB_PACKAGE
sudo dpkg --install DEB_PACKAGE
==================================================================================
#### Cleaning the Error popups
```
sudo rm /var/crash/*
```
==================================================================================
## Installing Brave browser :
===============
wget -O brave.deb https://laptop-updates.brave.com/latest/dev/ubuntu64
sudo dpkg -i ./brave.deb
## Android Studio
==============
ref : https://developer.android.com/studio/install.html
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
[refer][https://github.com/facebook/react-native/issues/7320]
`sudo apt-get install lib32stdc++6 lib32z1`
Errors
==========================
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
**Make sure there is no spaces in below syntax**
=============
export ANDROID_HOME=/home/iam/Android/Sdk
export PATH=$PATH:/home/iam/Android/Sdk/tools
export PATH=$PATH:/home/iam/Android/Sdk/platform-tools
=============
**This is not required**
/etc/environment
ANDROID_HOME="/home/iam/Android/Sdk"
JAVA_HOME=/usr/lib/jvm/java-8-oracle
**The above code is here just for reference, what I had done before.**
Android NDK = "/home/iam/Android/Sdk/ndk-bundle"
=========================================================
### PhP
### MySQL
[Reference 2][https://help.ubuntu.com/12.04/serverguide/mysql.html]
`
sudo apt-get install mysql-server
password for MySQL user 'root' : 'root123'
`
Running
`
sudo service mysql start
`
### MariaDB
`
sudo apt-get install mariadb-server
`
### Apache
[Reference][https://www.digitalocean.com/community/tutorials/how-to-configure-the-apache-web-server-on-an-ubuntu-or-debian-vps]
`
sudo apt-get update
sudo apt-get install apache2
`
Running
`
sudo service apache2
`
### NginX
`
sudo apt-get update
sudo apt-get install nginx
`
Start and Stop
`
sudo service nginx stop
sudo service nginx start
sudo service nginx restart
`
=========================================================
## Enabling / Disabling services at startup
### Status Check
sudo service mysql status
sudo service apache status
sudo service nginx status
### Apache
sudo update-rc.d apache2 disable
sudo update-rc.d apache2 enable
### MySQL
auto start : sudo update-rc.d mysql defaults
auto start : sudo update-rc.d -f mysql enable
auto stop : sudo update-rc.d -f mysql disable
auto remove : sudo update-rc.d -f mysql remove
### Nginx
sudo update-rc.d -f nginx enable
sudo update-rc.d -f nginx disable
@saumya
Copy link
Author

saumya commented Dec 10, 2016

Ubuntu 16.04 LTS

Bare minimum

Clear Error popups

sudo rm /var/crash/*

Chromium Browser

sudo apt install chromium-browser

GitGUI

Never do, All in one-insall like sudo apt install git-all

If already done that, here is the fix

sudo apt-get purge runit
sudo apt-get purge git-all
sudo apt-get purge git
sudo apt-get autoremove
sudo apt update
sudo apt install git 

GIT install : sudo apt install git
install ui: sudo apt install git-gui gitk

Just for reference:
sudo apt-get install git-gui gitk
sudo apt install git-gui gitk

Android Studio

Error
Unable to run mksdcard SDK tool.

Fix: Install 32bit libraries
apt-get : sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
apt : sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
for ReactNative install these 32bit libs
[refer][https://github.com/facebook/react-native/issues/7320]
apt-get : sudo apt-get install lib32stdc++6 lib32z1
apt : sudo apt install lib32stdc++6 lib32z1

From official google reference
apt-get : sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

Error: can not run android permission denied
Fix: Change mode to executable with sudo chmod a+x /home/iam/Android/Sdk/tools/android

NodeJS

install with package manager

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Remove NodeJS

sudo apt-get purge --auto-remove nodejs

sudo apt-get purge nodejs
sudo apt-get autoremove

Remove Node
sudo apt-get remove nodejs

=========================================================

N

Reference

curl -L https://git.io/n-install | bash

Uninstall n

/usr/bin/n
change owner : sudo chown -R iam /usr/bin/n
remove files : sudo rm -R /usr/bin/n

/usr/lib/node_modules/n/bin/n
sudo chown -R iam /usr/lib/node_modules/n
sudo rm -R /usr/lib/node_modules/n

/usr/local/n/
sudo chown -R iam /usr/local/n
sudo rm -R /usr/local/n

=========================================================

@saumya
Copy link
Author

saumya commented Dec 12, 2016

Android SDK

Change owner and permission

permission to execute

sudo chmod -R 755 /home/iam/Android/Sdk/tools/
//OR
sudo chmod -R a+x /home/iam/Android/Sdk/tools/

Android and its tools

Make Executable

sudo chmod -R +x /home/iam/Android/Sdk/tools/
sudo chmod -R +x /home/iam/Android/Sdk/platform-tools/
sudo chmod -R +x /home/iam/Android/Sdk/build-tools/

Make me the owner

sudo chown -R iam /home/iam/Android/Sdk/tools/
sudo chown -R iam /home/iam/Android/Sdk/platform-tools/
sudo chown -R iam /home/iam/Android/Sdk/build-tools/

Or, simply make the whole Android SDK folder owner as me and executable

sudo chown -R iam /home/iam/Android/Sdk/
sudo chmod -R +x /home/iam/Android/Sdk/

owner

sudo chown -R iam /home/iam/node_modules/
sudo rm -R /home/iam/node_modules/

@saumya
Copy link
Author

saumya commented Apr 26, 2017

Android Update


The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment