Tag Archives: CentOS

Resize Disk Using `growpart` on CentOS

First install growpart:

yum install cloud-utils-growpart

Check current disk info:

fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008d73a

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    41943039    20970496   83  Linux

Check disk partition info:

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   15G  4.5G  77% /
devtmpfs        486M     0  486M   0% /dev
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           496M  460K  496M   1% /run
tmpfs           496M     0  496M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/0

Run growpart on our device:

growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=41940992 end=41943040 new: size=83883999,end=83886047

Resize:

resize2fs /dev/vda1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
The filesystem on /dev/vda1 is now 10485499 blocks long.

Check if disk resized:

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   15G   24G  38% /
devtmpfs        486M     0  486M   0% /dev
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           496M  460K  496M   1% /run
tmpfs           496M     0  496M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/0

Install Tsunami UDP on CentOS 7

Install dependencies:

$ yum install cvs git gcc automake autoconf libtool -y

Download Tsunami UDP:

$ cd /tmp
$ cvs -z3 -d:pserver:anonymous@tsunami-udp.cvs.sourceforge.net:/cvsroot/tsunami-udp co -P tsunami-udp
$ cd tsunami-udp
$ ./recompile.sh
$ make install

Then on the server side:

$ tsunamid --port 46224 * # (Serves all files from current directory for copy)

On the client side:

$ tsunami connect <server_ip> get *

Transfer dataset back to S3:

aws s3 cp --recursive /mnt/bigephemeral s3://<your-new-bucket>/

Limitations:

  • Tsunami UDP transfers only files and doesn’t do directories/ subdirectories, we need to tar them all up as one single tar file (additional storage capacity needs to be taken into consideration).
  • Multi-threading is not supported.
  • Multi session not supported. Client supports only one connection to the server at a time. No parallel file transfer.
  • No resume or retry for file transfer.
  • Does not support Native encryption.

Refs:

redhat – No ruby-devel in RHEL7? – Stack Overflow

This answer comes by way of piecing together bits from other answers – so to the previous contributors…thank you because I would not have figured this out.This example is based on the RHEL 7 AMI (Amazon Managed Image) 3.10.0-229.el7.x86_64.So by default as mentioned above the optional repository is not enabled. Don’t add another repo.d file as it already exists just that it is disabled.To enable first you need the name. I used grep to do this:grep -B1 -i optional /etc/yum.repos.d/*above each name will be the repo id enclosed in [ ] look for the optional not optional-sourceEnable the optional repo:yum-config-manager –enable Refresh the yum cache (not sure if this is necessary but it doesn’t hurt):sudo yum makecacheFinally, you can install ruby-devel:yum install ruby-develDepending on your user’s permissions you may need to use sudo.

Source: redhat – No ruby-devel in RHEL7? – Stack Overflow

Install Transmission on CentOS 7

Nowadays it’s really simple to install Transmission on CentOS 7 or EL distro. First you need to install EPEL packages:

$ yum install epel-release
$ yum -y update

…or use the following command if you’re running Red Hat Enterprise Linux:

$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm

Install Transmission:

$ yum install transmission-cli transmission-common transmission-daemon

Create storage directory:

$ mkdir /ebs-data/transmission/
$ chown -R transmission.transmission /ebs-data/transmission/

Start and stop the Transmission to auto generate configs:

$ systemctl start transmission-daemon.service
$ systemctl stop transmission-daemon.service

To edit the config, you MUST first stop the daemon, otherwise the config will be overwritten after you restart the daemon:

$ systemctl stop transmission-daemon.service
$ var /var/lib/transmission/.config/transmission-daemon/settings.json

Edit config:

"download-dir": "/ebs-data/transmission",
"incomplete-dir": "/ebs-data/transmission",
"rpc-authentication-required": true,
"rpc-enabled": true,
"rpc-password": "my_password",
"rpc-username": "my_user",
"rpc-whitelist": "0.0.0.0",
"rpc-whitelist-enabled": false,

Save and start daemon:

$ systemctl start transmission-daemon.service

Access via your browser:

$ open http://localhost:9091/transmission/web/

Enable IPv6 Tunnel Broker on Aliyun CentOS 7

In /etc/modprobe.d/disable_ipv6.conf:

alias net-pf-10 off
#alias ipv6 off
options ipv6 disable=0

In /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.default.disable_ipv6=0
net.ipv6.conf.lo.disable_ipv6=0

Then run sysctl -p to take effect.

Then in Example Configurations under HE.net Tunnel Details page, in the dropdown menu select Linux-route2, copy all the commands and paste into your server:

modprobe ipv6
ip tunnel add he-ipv6 mode sit remote 1.2.3.4 local 5.6.7.8 ttl 255
ip link set he-ipv6 up
ip addr add 2001:470:18:d18::2/64 dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr

Test the tunnel:

ping6 irc6.oftc.net

SELinux policy for nginx and GitLab unix socket in Fedora 19

The installation of GitLab in Fedora 19 went fine. I followed the official installation guide with some deviations where necessary, mostly taken from the CentOS guide in gitlab-recipes. I setup nginx using the ssl config, and poked some holes in iptables. For systemd services I used these files.

Source: SELinux policy for nginx and GitLab unix socket in Fedora 19

Run `sudo` with Ansible `become` Option on Google Compute Engine

Playbook config:

- name: basic setup
  hosts: default
  user: user
  become: true
  become_user: root
  become_method: sudo
  roles:
    - tasks

If you got the following errors:

GATHERING FACTS *************************************************************** 
failed: [server1] => {"failed": true, "parsed": false}
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/user/.ssh/config
debug1: /Users/user/.ssh/config line 139: Applying options for server1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
sudo: sorry, you must have a tty to run sudo

Then visudo and disable requiretty:

Defaults    !requiretty