Skip to content

Instantly share code, notes, and snippets.

@saumya
Last active April 26, 2017 06:45
Show Gist options
  • Select an option

  • Save saumya/acfb66f94b12d8c8df0b59d416ca5f72 to your computer and use it in GitHub Desktop.

Select an option

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

saumya commented Dec 12, 2016

Copy link
Copy Markdown
Author

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

saumya commented Apr 26, 2017

Copy link
Copy Markdown
Author

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