- apt-get remove ubuntu-desktop
- apt-get install linux-server linux-image-server
- apt-get purge lightdm
- /etc/default/grub, change matching lines to below
- #GRUB_HIDDEN_TIMEOUT [comment it out]
- GRUB_CMDLINE_LINUX_DEFAULT=""
- GRUB_TERMINAL=console
- update-grub
- reboot
Sunday, 28 April 2013
Ubuntu: convert desktop to server fast
Below as root:
Thursday, 25 April 2013
tcpdump HTTP headers
- tcpdump -vvvs 1024 -l -A port 80 | egrep '^[A-Z][a-zA-Z\-]+:|GET|POST'
- Match your port, here it is 80, could be 8080 or 443, e.g.
Edit remote files with local editor using ssh and sshfs
- apt-get -y install sshfs
- Add your local user to the fuse group
- mkdir ~/mylocaldir
- sshfs -o idmap=user mylocaluser@myremoteserver.com:/remotepath ~/mylocaldir
- Edit files under ~/mylocaldir, and as you save them, they are automatically updated in /remotepath
Errors
- "Couldn't read packet: Connection reset by peer"
- change this line in your /etc/ssh/sshd_config file to match what's here
- Subsystem sftp internal-sftp
- happens on RedHat Enterprise 6.1 for sure
Quick CLI screenshots on Linux or Openbox / Fluxbox
- sudo apt-get -y install imagemagick eog
- import myscreenshot.jpg
- select portion of screen with the crosshairs
- eog myscreenshot.jpg
Meetings
- Who is participating and do I know what each of them wants to get out of this meeting?
- What are my goals and what's the minimum that I want to achieve?
- Can I give in on certain points?
- Are there issues I won't budge on?
- What are next steps after the meeting?
- Who will ultimately decide whether I get what I want or not?
- Are there things I don't want to lay out on the table and not discuss in this meeting?
- Who should do most of the talking?
Wednesday, 24 April 2013
keytool: put your SSL key into a new keystore
- openssl pkcs12 -export -in mycert.crt -inkey mykey.key -out myp12blob.p12 -name mykeystorealias -CAfile mycascert.crt
- Set the password to "changeit"
- keytool -importkeystore -deststorepass changeit -destkeypass changeit -destkeystore mykeystore -srckeystore myp12blob.p12 -srcstoretype PKCS12 -srcstorepass changeit -alias myalias
- keytool -list -v -keystore mykeystore
Friday, 12 April 2013
Cassandra in 30 seconds
- writes
- writes entries directly to disk without checking if they already exist
- does fancy indexing of entries
- returns a write "OK" to the writing client after a quorum of nodes have confirmed
- reads
- tries to return the newest entry when client does a read
- has methods to eventually get the newest entry to return even if old ones still around
- replication
- stores entries to multiple nodes if replication is turned on
- deletes
- doesn't offically delete, just marks dead entries with a "tombstone"
- compaction is what gets rid of old versions of entries and dead entries
- balancing
- automatically fills in data holes if a node disappears
- automatically spreads data if new nodes are added
- resurrection
- 3-nodes: X, Y, Z, all replicate all data
- server X goes down
- delete goes to Y and Z for key A
- Y and Z are "compacted"
- i.e., redundant keys & tombstones cleaned up / removed
- key A is completely gone as far as Y and Z know
- X comes up and has value for key A
- A is back! resurrected from the dead! life sucks.
- NOTE: if Y and Z didn't have tombstones removed, they would have had a date that was more recent than X's key A entry, so they would have invalidated X's key A. But, they are gone after a compaction or cleanup.
Move huge directory on the root partition to a huge non-root parition
Assumption: /mnt is a huge disk partition separate from the / partition (aka root partition)
- mkdir -p /mnt/home/myfatdirectory
- kill all processes that have open files to /home/myfatdirectory
- lsof /home/myfatdirectory
- make sure you get ZERO results, ie no processes have open files to this directory
- mv /home/myfatdirectory /home/myfatdirectory_old
- mkdir -p /home/myfatdirectory
- mount --bind /mnt/home/myfatdirectory /home/myfatdirectory
- add to bottom of /etc/fstab, so the mount is picked up on reboot
- /mnt/home/myfatdirectory /home/myfatdirectory none bind 0 0
- fix perms as necessary by interleaving your own steps into the above
- for the paranoid: you might want to make sure fstab entries work fine on reboot
Thursday, 11 April 2013
Find human-readable size of all files in a particular directory which have been modified in the last day and that are over 100 megs
- find /var -mtime -1 -type f -size +100M -exec ls -lh {} \;
Monday, 8 April 2013
Recover accidentally deleted file as long as some process still has it open, on Linux
- lsof | grep myfile
- the second column is the process id
- the number in the fourth column is the file descriptor
- cp /proc/<process id>/fd/<file descriptor> myfile.saved
Labels:
accident,
accidentally,
delete,
deleted,
file descriptor,
hold,
linux,
lsof,
pid,
proc,
process,
recover,
recovering,
recovery,
still open
Wednesday, 3 April 2013
Build unbound from source on redhat/centos
NOTE: unbound is now available via epel repo on Amazon Linux
Taken: https://calomel.org/unbound_dns.html
- install requirements
- yum groupinstall "Development Tools"
- yum install openssl-devel
- yum install expat-devel
- build
- ldns
- wget http://www.nlnetlabs.nl/downloads/ldns/ldns-1.6.16.tar.gz
- tar zxvf ldns-1.6.16.tar.gz
- cd ldns-1.6.16/
- ./configure --disable-gost --disable-ecdsa
- make
- make install
- unbound
- wget http://unbound.net/downloads/unbound-latest.tar.gz
- tar zxvf unbound-latest.tar.gz
- cd unbound-1.4.20/
- ./configure --disable-gost --disable-ecdsa
- make
- make install
- add libs to system lib path
- vi /etc/ld.so.conf.d/ldnsandunbound.conf
- add this one line
- /usr/local/lib
- sudo ldconfig
- add unbound user
- adduser --system unbound
- tweak config
- vi /usr/local/etc/unbound/unbound.conf
- see simple sample below
- run
- unbound
- check
- lsof -nP -i :53
- stop
- pkill unbound
- restart
- unbound
server:
verbosity: 1
interface: 0.0.0.0
access-control: 10.0.0.0/16 allow
forward-zone:
name: "my-vpc.internal"
forward-addr: 252.252.199.199
forward-first: no
Tuesday, 2 April 2013
Set up private, internal DNS for your VPC using Route 53 and unbound
http://aws.amazon.com/about-aws/whats-new/2014/11/05/amazon-route-53-now-supports-private-dns-with-amazon-vpc/
BELOW IS DEPRECATED!
- create a Hosted Zone, something like "mydomain.internal"
- get the IP addresses of the name servers assigned to your new zone
- STRIP OFF '.' at the end of the name servers or BOOM!
- create a new DHCP Options Set
- add the IP addresses you gathered above to the domain-name-servers field
- Change DHCP Options Set of your VPC by right-clicking it
- run sudo dhclient on any already-running instance in the VPC to pick up changes
- debug changes have taken place on an instance: cat /etc/resolv.conf
RECOMMEND ALTERNATE SOLUTION: here's a sample unbound.conf I ended up using for a DNS forwarding server within my VPC -- see comments below. I adjusted the "options set" to point at this DNS server instead, 10.0.0.254 in my case.
NOTE: Btw, unbound is available under "epel" yum repo.
server: verbosity: 1 interface: 0.0.0.0 access-control: 10.0.0.0/16 allow forward-zone: name: "mydomain.internal" forward-host: ns-123.awsdns-12.com forward-host: ns-234.awsdns-34.biz forward-host: ns-567.awsdns-56.net forward-host: ns-890.awsdns-78.org forward-first: no
See also:
unbound, custom records: http://sysadminandnetworking.blogspot.com/2014/05/unbound-custom-records.html
unbound, default to google: http://sysadminandnetworking.blogspot.com/2014/05/unbound-default-to-googles-dns.html
Labels:
aws,
dhcp,
domain-name-servers,
ec2,
hosted zone,
internal,
name servers,
nameservers,
options,
options set,
route 53,
route53,
vpc
Subscribe to:
Posts (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
brew install python3 mkdir -p ~/bin/python3 python3 -m venv ~/bin/python3 source ~/bin/python3/bin/activate enjoy!