Search This Blog

Showing posts with label Debian. Show all posts
Showing posts with label Debian. Show all posts

2018/02/15

Install MonoDevelop using Flatpak

To install FlatPak onto your debian machine add respository & then install flatpak package.

    Add Repositoy for flatpak:
        wget -O - https://sdk.gnome.org/apt/debian/conf/alexl.gpg.key|apt-key add -
        echo "deb [arch=amd64] https://sdk.gnome.org/apt/debian/ jessie main" > /etc/apt/sources.list.d/flatpak.list
 

    Update Package List : 
           we can install flatpak by first updating package list         
                       apt update   
                       apt install flatpak
 

    Testing flatpak with monodevlop:
       You can download monodevelop.flatpakref from monodevlop.org portal naviagate to your download directory

             flatpak install --user --from monodevelop.flatpakref
                         or
             flatpak install --user --from https://mono-project.azureedge.net/repo/monodevelop.flatpakref
 

    To launch mono-develop with flatpack go ahead and run below line
        flatpak run com.xamarin.MonoDevelop

2017/08/12

Debian 9 - RabbitMQ Installation Notes

Add respository below into /etc/apt/sources.list
    deb http://www.rabbitmq.com/debian/ testing main
    apt-get update
Install
    apt-get install rabbitmq-server -y

Check Status
    service rabbitmq-server status

version check
    rabbitmqctl status | grep RabbitMQ 

Enable plugins required for rabbitmq management console
    rabbitmq-plugins enable rabbitmq_management

Create User:
    rabbitmqctl add_user myuser mypass

Add User to administrator role
    rabbitmqctl set_user_tags myuser administrator

Give All Access to User myuser:
    rabbitmqctl set_permissions -p / myuser ".*" ".*" ".*"

Set Connection limit:
    echo "ulimit -n [limit]" | sudo tee /etc/default/rabbitmq-server

Web Admin:
    http://localhost:15672/


CLI:
Download https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/rabbitmq_v3_6_10/bin/rabbitmqadmin python script,move it /usr/local/bin
   
    chmod +x rabbitmqadmin
    rabbitmqadmin --help

List all users
    rabbitmqadmin list users

List Exchanges:
    python rabbitmqadmin list exchanges

List Node:
    rabbitmqadmin list nodes
    rabbitmqadmin --username=myuser --password=mypass list nodes

List queue:
    rabbitmqadmin --username=guest --password=guest list queues

Export Configuration:
    rabbitmqadmin export rabbit.definitions.json

Import Configuration:
    rabbitmqadmin -q import rabbit.definitions.json

Close all connections:
    rabbitmqadmin -f tsv -q list connections name | while read conn ; do rabbitmqadmin -q close connection name="${conn}" ; done

declare a new queue:
    rabbitmqadmin declare queue name="temp_q" durable=true auto_delete=false

declaring an exchange:
    rabbitmqadmin declare exchange name="tempExchange" type="direct" auto_delete=false

    possible values for type of exchange are Direct,Fanout,Topic & Headers.

declaring a Binding:
    rabbitmqadmin declare binding source="myExchange" destination_type="queue" destination="myQueue" routing_key="myMessage"

Purge a single queue:
    rabbitmqadmin purge queue name=jobs
    output:
        queue purged

First Message of queue:
    rabbitmqadmin --username=sangram --password=sangram get queue=jobs requeue=false count=10
    output:
        +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+
        | routing_key | exchange | message_count |           payload           | payload_bytes | payload_encoding | redelivered |
        +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+
        | jobs        |          | 28            | 1500218536:: work work work | 27            | string           | True        |
        | jobs        |          | 27            | 1500218537:: work work work | 27            | string           | True        |
        | jobs        |          | 26            | 1500218538:: work work work | 27            | string           | True        |
        | jobs        |          | 25            | 1500218539:: work work work | 27            | string           | True        |
        | jobs        |          | 24            | 1500218540:: work work work | 27            | string           | True        |
        | jobs        |          | 23            | 1500218541:: work work work | 27            | string           | True        |
        | jobs        |          | 22            | 1500218542:: work work work | 27            | string           | True        |
        | jobs        |          | 21            | 1500218543:: work work work | 27            | string           | True        |
        | jobs        |          | 20            | 1500218544:: work work work | 27            | string           | True        |
        | jobs        |          | 19            | 1500218545:: work work work | 27            | string           | True        |
        +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+

   
    if we add "requeue=false count=10" then last 10 get removed from queue for next view of this queue.



        rabbitmqadmin get queue=jobs requeue=false count=10 or

    rabbitmqadmin --username=sangram --password=sangram get queue=jobs count=10
    output:

            +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+
            | routing_key | exchange | message_count |           payload           | payload_bytes | payload_encoding | redelivered |
            +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+
            | jobs        |          | 8             | 1500218347:: work work work | 27            | string           | True        |
            | jobs        |          | 7             | 1500218348:: work work work | 27            | string           | False       |
            | jobs        |          | 6             | 1500218349:: work work work | 27            | string           | False       |
            | jobs        |          | 5             | 1500218350:: work work work | 27            | string           | False       |
            | jobs        |          | 4             | 1500218351:: work work work | 27            | string           | False       |
            | jobs        |          | 3             | 1500218352:: work work work | 27            | string           | False       |
            | jobs        |          | 2             | 1500218353:: work work work | 27            | string           | False       |
            | jobs        |          | 1             | 1500218354:: work work work | 27            | string           | False       |
            | jobs        |          | 0             | 1500218355:: work work work | 27            | string           | False       |
            +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+   

    rabbitmqadmin get queue=jobs count=-1
        output:
            +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+
            | routing_key | exchange | message_count |           payload           | payload_bytes | payload_encoding | redelivered |
            +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+
            | jobs        |          | 40            | 1500219135:: work work work | 27            | string           | True        |
            | jobs        |          | 39            | 1500219136:: work work work | 27            | string           | True        |
            | jobs        |          | 38            | 1500219137:: work work work | 27            | string           | True        |
            | jobs        |          | 37            | 1500219138:: work work work | 27            | string           | True        |
            | jobs        |          | 36            | 1500219159:: work work work | 27            | string           | True        |
            | jobs        |          | 35            | 1500219160:: work work work | 27            | string           | True        |
            | jobs        |          | 34            | 1500219161:: work work work | 27            | string           | True        |
            | jobs        |          | 33            | 1500219162:: work work work | 27            | string           | True        |
            | jobs        |          | 32            | 1500219163:: work work work | 27            | string           | True        |
            | jobs        |          | 31            | 1500219164:: work work work | 27            | string           | True        |
            | jobs        |          | 30            | 1500219165:: work work work | 27            | string           | True        |
            | jobs        |          | 29            | 1500219166:: work work work | 27            | string           | True        |
            | jobs        |          | 28            | 1500219167:: work work work | 27            | string           | True        |
            | jobs        |          | 27            | 1500219168:: work work work | 27            | string           | True        |
            | jobs        |          | 26            | 1500219169:: work work work | 27            | string           | True        |
            | jobs        |          | 25            | 1500219170:: work work work | 27            | string           | True        |
            | jobs        |          | 24            | 1500219171:: work work work | 27            | string           | True        |
            | jobs        |          | 23            | 1500219172:: work work work | 27            | string           | True        |
            | jobs        |          | 22            | 1500219173:: work work work | 27            | string           | True        |
            | jobs        |          | 21            | 1500219174:: work work work | 27            | string           | True        |
            | jobs        |          | 20            | 1500219175:: work work work | 27            | string           | True        |
            | jobs        |          | 19            | 1500219176:: work work work | 27            | string           | True        |
            | jobs        |          | 18            | 1500219177:: work work work | 27            | string           | True        |
            | jobs        |          | 17            | 1500219178:: work work work | 27            | string           | True        |
            | jobs        |          | 16            | 1500219179:: work work work | 27            | string           | True        |
            | jobs        |          | 15            | 1500219180:: work work work | 27            | string           | True        |
            | jobs        |          | 14            | 1500219181:: work work work | 27            | string           | True        |
            | jobs        |          | 13            | 1500219182:: work work work | 27            | string           | True        |
            | jobs        |          | 12            | 1500219183:: work work work | 27            | string           | True        |
            | jobs        |          | 11            | 1500219184:: work work work | 27            | string           | True        |
            | jobs        |          | 10            | 1500219185:: work work work | 27            | string           | True        |
            | jobs        |          | 9             | 1500219186:: work work work | 27            | string           | True        |
            | jobs        |          | 8             | 1500219187:: work work work | 27            | string           | True        |
            | jobs        |          | 7             | 1500219188:: work work work | 27            | string           | True        |
            | jobs        |          | 6             | 1500219189:: work work work | 27            | string           | True        |
            | jobs        |          | 5             | 1500219190:: work work work | 27            | string           | True        |
            | jobs        |          | 4             | 1500219191:: work work work | 27            | string           | True        |
            | jobs        |          | 3             | 1500219192:: work work work | 27            | string           | True        |
            | jobs        |          | 2             | 1500219193:: work work work | 27            | string           | False       |
            | jobs        |          | 1             | 1500219194:: work work work | 27            | string           | False       |
            | jobs        |          | 0             | 1500219195:: work work work | 27            | string           | False       |
            +-------------+----------+---------------+-----------------------------+---------------+------------------+-------------+   

        "count=-1" forces all messges to display absence of count give only first message.


        When we have both publisher & subscriber running effectively publisher publish the message & worker get those message to act on and get removed from queue.


2016/08/03

Setting Up GitHub on Debian 8

to setup GitHub on your machine just open a Bash terminal and become super user by issuing “Su” command

>su

It will ask for password of super user (actually substitute user though) provide same ,now it will drop you to familiar terminal prompt.
Using super user login ,We need to update our Repository List as follows
>apt-get update

after updating repo list we will install git to our Debian machine
>apt-get install git-core

Now we have to register at GitLab after registering there create a project say “myproject”,suppose your gitlab user name is “ yourusername” & email id used for registration is “youremail@server .com”
Generating SSH Key:
Now we might need to generate SSH key for secure communication between GitLab server & our machine.
Run following command to check if ssh key is already generated on your debian machine

>cat ~/.ssh/id_rsa.pub  
 if it yield some response then its there else generate new one as follows

>ssh-keygen -t rsa -C "youremail@server.com"

copy newly generated SSH key or existing one by looking at output of command below
>cat ~/.ssh/id_rsa.pub

response is something similar to below
ssh-rsa LMRPTYB3NzaC1yc2FRFGHFGFABAAABAQDs+y4/vM7GHVGHGhjhkjuzq/DFDHHD.FJFGJFyB5NIMKF/ZFVQ0RTBwAcxtyg++LgoVX3h5YLLdRbxn2Q54M0hAIlo05OZXQlAWDwE1RF+Mfis7IHEldHjV/qmnvcEca0ODsiLFJJFGJ7U/kHEEkfZqGFGHFtrfthfghfhVE3S+GHGHJGHGHGHGHGHJG/GGFHJGHJGHJGihkjgyhg youremail@server.com

   copy whole stuff from response of command starting from ssh-rsa till end.
now go to your githab profile setting into “SSH Key” tab and add key.
Now we need to tail our machine about destination as follows

>git config --global user.name "yourusername" git config --global user.email "youremail@server.com"
now move to your existing project root as follows

>cd existing_folder 

now you can push your project to GitLab as follows. 

>git init 
>git remote add origin git@gitlab.com:youremailusername/myproject .git 
>git add . 
 [Note: the dot(.) in above command is not by mistake but required tell all files within folder] 

>git commit -m "my first githab commit" 
>git push -u origin master
 
suppose we want to push a new project then move to folder where your project will reside and issue following command that will copy content in GitHab project newly created through website obiviously at this point it is empty,yet it will create .git folder which will act as setting for git library to which git destination project belong what is current state & current branch

>git clone git@gitlab.com:youremailusername/myproject.git 
>add a readme file with some information about project  as follows
>cd myproject touch README.md git add README.md 
>nano  README.md
>git commit -m "add README" 
>git push -u origin master
Now check on GitLab server  if readme.md file saved on server under given project.