yourfriendcaspian
yourfriendcaspian
Reputation Top 1%
yourfriendcaspian
I just like to press the buttons
51 Snippets  (8th place)
Published
2 Channels
Created
10 Channels
Following
Sep 13, 2017
Last Visit
Dec 12, 2016
Registered
1258 points  (28th place)
Reputation
Top 5% Publisher
Junior Code Generator
Serious Code Generator
Senior Code Generator
Master Code Generator
Junior Publisher
Senior Publisher
Junior Topic Creator
Junior Trend Maker
Serious Popular Coder
Senior Popular Coder
Junior Autobiographer
Serious Autobiographer
Serious Famous Coder

Recent Snippets See all snippets by yourfriendcaspian

public by yourfriendcaspian created Sep 2, 2017  114  0  2  0

Instructions for installing the most popular webdrivers, and then the latest version of the standalone Selenium server

Instructions for installing the most popular webdrivers, and then the latest version of the standalone Selenium server: selenium-instructions.md
# Steps For Setting Up Selenium And The Webdrivers

### Install The Firefox Geckodriver

* Download [the latest Geckodriver for Firefox](https://github.com/mozilla/geckodriver/releases)
* then `mv` that file to `/usr/local/bin/geckodriver` and `sudo chmod +x /usr/local/bin/geckodriver`
* make sure you have `"webdriver.firefox.profile" : "geckodriver",` in your `nightwatch.json` file if you are using it

### Install The Chromedriver

* Download the latest version [from the Chrome site](https://sites.google.com/a/chromium.org/chromedriver/downloads)
* unzip it if it is a zip file
* then `mv` that file to `/usr/local/bin/chromedriver` and `sudo chmod +x /usr/local/bin/chromedriver`

### Install the Safari Driver

* Download the `SafariDriver.safariextz` [from the release site](http://selenium-release.storage.googleapis.com/index.html?path=2.45/)
* Double click on the file and it will open in Safari
* Accept the file as trusted
* It will now show in your extensions

### Build the latest Selenium binary

* `git clone git@github.com:SeleniumHQ/selenium.git`
* `cd selenium`
* `./go clean release`
* `cd build/dist`
* You can now run the server with the following: `java -jar selenium-server-standalone-3.0.0-beta1.jar`
* _you may have a server of a different name depending on when you read this tutorial_

### Running the server

* cd to the directory where you build the jar file
* run: `java -jar selenium-server-standalone-3.0.0-beta1.jar`

You can also alias the function in a `~/.bashrc` or `~/.zshrc` with:

```sh
alias selenium="java -jar /path/to/build/dist/folder/selenium-server-standalone-3.0.0-beta1.jar"
```

Remember: _You may have a server of a different name depending on when you read this tutorial_

;

public by yourfriendcaspian created Sep 2, 2017  104  0  1  0

Cómo instalar MySql en Debian/derivados, crear Bases de Datos y Usuarios para usarlos en Django

Cómo instalar MySql en Debian/derivados, crear Bases de Datos y Usuarios para usarlos en Django: Mysql and Django.md
Instalar Mysql con Python y Django Debian/Derivados 
=====================
 
 
Para instalar necesitamos tener unas dependencias en el sistema por ahora mostraremos en equipos **Debian y Derivados**. Pero primero instalares actualizaciones y MySQL
 
 
----------
Actualizaciones y MySQL
---------
 
**Actualizar Sistema** lo hacemos con los siguientes comandos
 
```
$ sudo apt-get update
$ sudo apt-get upgrade
```
 
> **NOTA:** Cada Sistema tiene sus comandos para actualización, si es que tu máquina no es derivada de Debian **buscalos** :D
 
#### <i class="icon-file"></i> Instalación de MySQL
 
Instalamos Mysql (5.5.*)
```
$ sudo apt-get install mysql-server mysql-client
Passwd for 'root' user: mypasswd
```
Al final ejecutamos este comando para darle mas seguridad a nuestra BD
 
```
$ mysql_secure_installation
```
Revisar atentanmente los cambios que se harán, la primera pregunta es el passwd root
SI desea mantenerla o cambiarla, y sigue con otras preguntas de seguridad.
 
 
#### <i class="icon-folder-open"></i> Crear una base de datos y un usuario para la BD
 
Ahora crearemos la BD a la que se conectara DJango y un Usuario con Passwd para que acceda a ella.
Existen dos maneras de hacerlo:
```
echo "CREATE DATABASE DATABASENAME;" | mysql -u root -p
echo "CREATE USER 'DATABASEUSER'@'localhost' IDENTIFIED BY 'PASSWORD';" | mysql -u root -p
echo "GRANT ALL PRIVILEGES ON DATABASENAME.* TO 'DATABASEUSER'@'localhost';" | mysql -u root -p
echo "FLUSH PRIVILEGES;" | mysql -u root -p
```
Así deberan poner su passwd de mysql en cada línea ó también pueden hacerlo de la siguiente manera
 
```
$ mysql -u root -p
```
Introducen su passwd y a continuación hacen lo siguiente.
 
```
CREATE DATABASE DATABASENAME;
CREATE USER 'DATABASEUSER'@localhost IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON DATABASENAME.* TO 'DATABASEUSER'@localhost;
FLUSH PRIVILEGES;
exit
```
 
#### <i class="icon-pencil"></i> Verificamos Dependencias
 
Sólo hay unas cuantas dependencias pero hay que estar seguros
 
```
$ sudo apt-get install libmysqlclient-dev python-dev
```
 
#### <i class="icon-trash"></i> Instalando driver mysql-python con PIP
 
Hasta aquí es todo sólo procedemos a instalar Pip en nuestro entorno virtual o globalmente
 
```
$ sudo pip install mysql-python
```
 
 
----------
<i class="icon-hdd"></i> Resumen
---------
Como podrás ver ahora puedes crear DB y Usuarios para cada Proyecto de Django.
 

 
 
 
 


;

public by yourfriendcaspian created Sep 2, 2017  111  0  2  0

Install Mysql with Python and Django Debian/Derivatives - Translated

Install Mysql with Python and Django Debian/Derivatives - Translated: mysql_python_on_debian.txt
#Install Mysql with Python and Django Debian/Derivatives 

#To install we need to have some dependencies in the system for now we will show on
#Debian and Derivatives.

#But first install updates and MySQL

```
$ sudo apt-get update
$ sudo apt-get upgrade
```	

# ** NOTE: ** 
#Each System has its commands for updating, if your machine is not derived from Debian ** look for them **

##Install MySQL

```
$ sudo apt-get install mysql-server mysql-client
Passwd for 'root' user: <password>
```

#At the end we execute this command to give more security to our BD

```
$ mysql_secure_installation
```

#Check carefully the changes that will be made, the first question is the passwd for root,
#IF you want to keep or change it, and continue with other security questions.

##Create a database and a user for the DB

#Now we will create the DB that will be connected to DJango and a User with Passwd to access it.
#There are two ways to do this:

```
echo "CREATE DATABASE <DATABASENAME>;" | mysql -u root -p
echo "CREATE USER '<DATABASEUSER>'@'localhost' IDENTIFIED BY '<PASSWORD>';" | mysql -u root -p
echo "GRANT ALL PRIVILEGES ON <DATABASENAME>.* TO '<DATABASEUSER>'@'localhost';" | mysql -u root -p
echo "FLUSH PRIVILEGES;" | mysql -u root -p
```

#So they should put their passwd of mysql in each line or
#they can also do it of the following way

```
$ mysql -u root -p
```

#Enter your passwd and then do the following.

```
CREATE DATABASE <DATABASENAME>;
CREATE USER '<DATABASEUSER>'@localhost IDENTIFIED BY '<PASSWORD>';
GRANT ALL PRIVILEGES ON <DATABASENAME>.* TO '<DATABASEUSER>'@localhost;
FLUSH PRIVILEGES;
exit
```

#We Check Dependencies
#There are only a few dependencies but you have to be sure

```
$ sudo apt-get install libmysqlclient-dev python-dev
```

#So far it's all just proceed to install pip in our virtual environment or globally

```
$ sudo -H pip install mysql-python
```

#As you can see now you can create DB and Users for each Django Project

;

public by yourfriendcaspian created Sep 2, 2017  87  1  1  0

Unattended Ubuntu Install- Download a non graphical Ubuntu installation ISO

Unattended Ubuntu Install- Download a non graphical Ubuntu installation ISO: ubuntu_unattended_install.md
https://askubuntu.com/a/122506/209043


wget http://www.instalinux.com/download/iso1132.iso -O /root/iso1132.iso
wget http://www.instalinux.com/download/preseed1132.txt -O preseed.cfg


---


The complete solution is:

Remaster a CD, ie, download a non graphical ubuntu installation ISO (server or alternate installation CD), mount it

    $ sudo su -
    # mkdir -p /mnt/iso
    # mount -o loop ubuntu.iso /mnt/iso

Copy the relevant files to a different directory

    # mkdir -p /opt/ubuntuiso
    # cp -rT /mnt/iso /opt/ubuntuiso

Prevent the language selection menu from appearing

    # cd /opt/ubuntuiso
    # echo en >isolinux/lang

Use GUI program to add a kickstart file named `ks.cfg`

    # apt-get install system-config-kickstart
    # system-config-kickstart # save file to ks.cfg

To add packages for the installation, add a `%package` section to the `ks.cfg` kickstart file, append to the end of `ks.cfg` file something like this.

    %packages
    @ ubuntu-server
    openssh-server
    ftp
    build-essential

This will install the ubuntu-server "bundle", and will add the `openssh-server`, `ftp` and `build-essential` packages.

Add a preseed file, to suppress other questions

    # echo 'd-i partman/confirm_write_new_label boolean true
    d-i partman/choose_partition \
    select Finish partitioning and write changes to disk
    d-i partman/confirm boolean true' > ks.preseed

Set the boot command line to use the kickstart and preseed files

    # vi isolinux/txt.cfg

Search for

    label install
      menu label ^Install Ubuntu Server
      kernel /install/vmlinuz
      append  file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz quiet --

add `ks=cdrom:/ks.cfg` and `preseed/file=/cdrom/ks.preseed` to the append line. You can remove the `quiet` and `vga=788` words. It should look like

      append file=/cdrom/preseed/ubuntu-server.seed \
         initrd=/install/initrd.gz \
         ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --

Now create a new iso

    # mkisofs -D -r -V "ATTENDLESS_UBUNTU" \
         -cache-inodes -J -l -b isolinux/isolinux.bin \
         -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
         -boot-info-table -o /opt/autoinstall.iso /opt/ubuntuiso

That's it. You'll have a CD that would install an Ubuntu system once you boot from it, without requiring a single keystroke.


---


To bypass the need to press enter on boot change the timeout value from `0` to `10` in `/isolinux/isolinux.cfg`: timeout `10` Note that a value of `10` represents `1` second



---

# Last

mkisofs -D -r -V "ATTENDLESS_UBUNTU"      -cache-inodes -J -l -b isolinux.bin      -c boot.cat -no-emul-boot -boot-load-size 4      -boot-info-table -o /root/autoinstall.iso /opt/ubuntuiso



;

public by yourfriendcaspian created Sep 2, 2017  73  0  1  0

Provision Ubuntu 16.04 Server

Provision Ubuntu 16.04 Server: ubuntu_server_provision.txt
- Postgres
sudo apt install postgresql

move databases

- Samba File Server
https://help.ubuntu.com/lts/serverguide/samba-fileserver.html



- Elastic Search

https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-on-an-ubuntu-vps

sudo add-apt-repository ppa:webupd8team/java
sudo apt install oracle-java8-installer

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.deb
sudo dpkg -i elasticsearch-5.4.0.deb 

- Logstash

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list

sudo apt install logstash=1:5.4.0-1 

sudo systemctl stop logstash
sudo systemctl start logstash
sudo systemctl enable logstash

- Kibana
https://www.elastic.co/guide/en/kibana/current/deb.html

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

sudo apt-get install apt-transport-https

echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list

sudo systemctl enable kibana
--------------------

- Beats

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list

sudo apt-get update && sudo apt-get install filebeat

# sudo update-rc.d filebeat defaults 95 10


- Mongo
https://docs.mongodb.com/manual/administration/production-notes/#kernel-and-file-systems
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt update

apt cache madison mongodb-org
sudo apt install mongodb-org=3.4.4

move databases

-----------

- Neo4j
https://neo4j.com/download/community-edition/

sudo wget https://neo4j.com/artifact.php?name=neo4j-community-3.2.0-unix.tar.gz


https://www.digitalocean.com/community/tutorials/how-to-install-neo4j-on-an-ubuntu-vps

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -
echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j.list
sudo apt update

apt-cache madison neo4j | head
sudo apt install neo4j=3.2.0


## nginx 

apt-cache madison nginx 

     nginx | 1.10.0-0ubuntu0.16.04.4 | http://tr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     nginx | 1.10.0-0ubuntu0.16.04.4 | http://tr.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages
     nginx | 1.10.0-0ubuntu0.16.04.4 | http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
     nginx | 1.10.0-0ubuntu0.16.04.4 | http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages
     nginx | 1.9.15-0ubuntu1 | http://tr.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
     nginx | 1.9.15-0ubuntu1 | http://tr.archive.ubuntu.com/ubuntu xenial/main i386 Packages


apt install nginx=1.10.0-0ubuntu0.16.04.4


----------------------------------------

- Docker 
https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository

ahmed@ubuntuserver:~$ apt-cache madison docker-ce
 docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

sudo apt install docker-ce=17.03.1~ce-0~ubuntu-xenial

- Docker Machine Host

docker-machine create --driver none --url=tcp://192.168.1.21:2376 default
docker-machine regenerate-certs default


- KVM

https://help.ubuntu.com/community/KVM/Installation

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils


sudo apt-get install nmap

sudo apt install python-setuptools
sudo apt install python-pip



- Influx Time Series DB


docker pull telegraf:1.3-alpine
wget https://dl.influxdata.com/telegraf/releases/telegraf_1.3.1-1_amd64.deb
sudo dpkg -i telegraf_1.3.1-1_amd64.deb

docker pull influxdb:1.2-alpine
wget https://dl.influxdata.com/influxdb/releases/influxdb_1.2.4_amd64.deb
sudo dpkg -i influxdb_1.2.4_amd64.deb

docker pull quay.io/influxdb/chronograf:1.3.1.0
wget https://dl.influxdata.com/chronograf/releases/chronograf_1.3.1.0_amd64.deb
sudo dpkg -i chronograf_1.3.1.0_amd64.deb


docker pull kapacitor:1.3.1-alpine
wget https://dl.influxdata.com/kapacitor/releases/kapacitor_1.3.1_amd64.deb
sudo dpkg -i kapacitor_1.3.1_amd64.deb




;