Chỉ nên cấu hình Keep Media 1 week vì phần này là những file Telegram download về cache trong máy, nếu cần dùng thì Telegram sẽ download lại, những file nào cũ hơn thời gian này sẽ được dọn dẹp khỏi máy.
Thiên Toán
Credit Builder
15/4/20
Dọn dẹp ổ cứng trên macos (2)
Ổ cứng đầy có thể do nhiều nguyên nhân trong đó có dữ liệu sinh ra từ ứng dụng. Nếu các bạn sử dụng Telegram mà hay join vào các group ăn lẩu online thì nên kiểm tra và cấu hình phần Storage Usage để tinh giản bộ nhớ như sau.
6/4/20
Dọn dẹp ổ cứng trên macos
Sau 50s scan thì em nó cho ra report như sau
Mình đi khám phá vào hang cùng ngõ hẻm thấy có mấy folder ngốn space nhiều mà trước giờ không biết ví dụ:
- Library > Applicaton Support > Spotify > PersistentCache
- Library > Updates
- Library > Applicaton Support > Code > User
- Library > Applicaton Support > ZaloPC
...
Lật qua lật lại cuối cùng quyết định, move 1 phần qua external disk + delete. Vậy là ổ cứng trống được thêm 30% :D
(1) http://www.uderzo.it/main_products/space_sniffer/
(2) https://daisydiskapp.com/index.html
(3) https://www.studentappcentre.com/App/DaisyDisk
12/10/19
What I do with fresh Macbook first
Install Homebrew
Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's macOS operating system and Linux. The name is intended to suggest the idea of building software on the Mac depending on the user's taste. - Wikipedia
Why we must replace default macOS Terminal to iTerm2 ?
There are 2 ways to install iTerm2:
- Download from https://www.iterm2.com/downloads.html and drag & drop to Application.
- Use Homebrew
ZSH, also called the Z shell, is an extended version of the Bourne Shell (sh), with plenty of new features, and support for plugins and themes. Since it’s based on the same shell as Bash, ZSH has many of the same features, and switching over is a breeze.
src: https://github.com/MartinSeeler/iterm2-material-design/blob/master/img/screen-mock-1.jpg
- Click Color Presets… at the bottom right
- Click Import…
- Select the material-design-colors.itermcolors file
- Select the material-design-colors from Load Presets…
iTerm2 with Dracular theme ref: https://draculatheme.com/assets/img/screenshots/iterm.png
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Install iTerm2

Why we must replace default macOS Terminal to iTerm2 ?
There are 2 ways to install iTerm2:
- Download from https://www.iterm2.com/downloads.html and drag & drop to Application.
- Use Homebrew
brew cask install iterm2Install zsh
ZSH, also called the Z shell, is an extended version of the Bourne Shell (sh), with plenty of new features, and support for plugins and themes. Since it’s based on the same shell as Bash, ZSH has many of the same features, and switching over is a breeze.
brew install zshInstall `oh-my-zsh`
Oh-My-Zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes and a few things that make you shout... “Oh My ZSH!”Install with terminal
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"Config material design colours

cd Downloads- Go to iTerm2 > Preferences > Profiles > Colors Tab
curl -O https://raw.githubusercontent.com/MartinSeeler/iterm2-material-design/master/material-design-colors.itermcolors
- Click Color Presets… at the bottom right
- Click Import…
- Select the material-design-colors.itermcolors file
- Select the material-design-colors from Load Presets…

iTerm2 with Dracular theme ref: https://draculatheme.com/assets/img/screenshots/iterm.png
20/7/19
No module named 'distutils.spawn'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 22, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
https://superuser.com/questions/1319047/cant-install-virtual-interpreter-in-pycharm-in-linux
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 22, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
sudo apt-get install python3-distutils
12/7/19
Setup OpenStack EOL (end-of-life) version on Centos 7
Hôm trước mình có tìm hiểu Cloudbreak triển khai trên OpenStack thì được biết là Cloudbreak hỗ trợ tới phiên bản OpenStack Mitaka (1), nhưng Mitaka đã hết hạn hỗ trợ (end-of-life) nên sẽ không thể các đặt theo cách thông thường (2). Mình thử tìm hiểu cách cài Mitaka và đã thành công. Tutorial như bên dưới.
Mình triển khai trên máy ảo VMWare cấu hình:
- OS CentOS 7 (minimal)
- Processor: 4 core (enable Virtual Intel VT-x/EPT or AMD-V/RVI)
- Memory: 8 GB
- Hard disk (SCSI): 50GB
- Network Adapter: NAT
- Yêu cầu setup dưới user có quyền sudo
Cấu hình Static IP
- Tắt NetworkManager
systemctl stop NetworkManager
systemctl disable NetworkManager
- Cấu hình IP Static
systemctl stop NetworkManager
systemctl disable NetworkManager
- Cấu hình IP Static
vi /etc/sysconfig/network-scripts/ifcfg-ens33
# Thay đổi như bên dưới
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.168.128
Lưu ý: IPADDR phải dựa trên dải IP trong NAT network card của VMWare, ví dụ như mình có Subnet IP là 192.168.168.0 và DHCP start từ 192.168.168.3
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.168.128
Lưu ý: IPADDR phải dựa trên dải IP trong NAT network card của VMWare, ví dụ như mình có Subnet IP là 192.168.168.0 và DHCP start từ 192.168.168.3
- Update Gateway
vi /etc/sysconfig/network
# Cấu hình như bên dưới
NETWORKING=yes
GATEWAY=192.168.168.2
Lưu ý: Gateway này trong NAT Settings của network card.
- Update DNS
vi /etc/resolv.conf
# Thêm dòng bên dưới
nameserver 8.8.8.8
- Sau cùng là restart network
systemctl restart network
- Để chắc chắn VM đã kết nối được internet dùng
$ ping google.com
PING google.com (216.58.203.238): 56 data bytes
64 bytes from 216.58.203.238: icmp_seq=0 ttl=55 time=83.547 ms
64 bytes from 216.58.203.238: icmp_seq=1 ttl=55 time=92.967 ms
64 bytes from 216.58.203.238: icmp_seq=2 ttl=55 time=67.525 ms
Tắt SELINUX
SELinux (Security-Enhanced Linux) là một mô đun bảo mật ở nhân của Linux, cung cấp cơ chế hỗ trợ các chính sách bảo mật kiểm soát truy cập (access control), bao gồm các điều khiển truy nhập bắt buộc theo phong cách Bộ Quốc phòng Hoa Kỳ (MAC).
- Để chắc chắn VM đã kết nối được internet dùng
$ ping google.com
PING google.com (216.58.203.238): 56 data bytes
64 bytes from 216.58.203.238: icmp_seq=0 ttl=55 time=83.547 ms
64 bytes from 216.58.203.238: icmp_seq=1 ttl=55 time=92.967 ms
64 bytes from 216.58.203.238: icmp_seq=2 ttl=55 time=67.525 ms
Tắt SELINUX
SELinux (Security-Enhanced Linux) là một mô đun bảo mật ở nhân của Linux, cung cấp cơ chế hỗ trợ các chính sách bảo mật kiểm soát truy cập (access control), bao gồm các điều khiển truy nhập bắt buộc theo phong cách Bộ Quốc phòng Hoa Kỳ (MAC).
Nếu để SELinux sẽ ảnh hưởng một số phần về network trong OpenStack.
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
Reboot sync;reboot sau đó check bằng
sestatus
SELinux status: disabled
Cài đặt các dependencies cần thiết
yum install -y qemu-kvm libvirt-client libvirt-daemon libvirt-daemon-driver-qemu python-setuptools
Khai báo repos cho OpenStack Mitaka
yum install -y https://repos.fedorapeople.org/repos/openstack/EOL/openstack-mitaka/rdo-release-mitaka-7.noarch.rpm
yum clean metadata
yum install -y centos-release-openstack-mitaka
Sau khi chạy hết block lệnh trên sẽ ra lỗi
yum clean metadata
yum install -y centos-release-openstack-mitaka
Sau khi chạy hết block lệnh trên sẽ ra lỗi
failure: repodata/repomd.xml from openstack-mitaka: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/7/cloud/x86_64/openstack-mitaka/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Nguyên nhân là repo này đã bị xóa khỏi mirror trên Centos, vì vậy mình đã thử tìm mirror khác. Sau khi search openstack-mitaka/repodata/repomd.xml thì thấy có mirror http://mirror.neu.edu.cn còn repo của Mitaka.
http://mirror.centos.org/centos/7/cloud/x86_64/openstack-mitaka/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Nguyên nhân là repo này đã bị xóa khỏi mirror trên Centos, vì vậy mình đã thử tìm mirror khác. Sau khi search openstack-mitaka/repodata/repomd.xml thì thấy có mirror http://mirror.neu.edu.cn còn repo của Mitaka.
Lỗi trên fix bằng
# đổi baseurl thành bên dưới
http://mirror.neu.edu.cn/centos/7/cloud/$basearch/openstack-mitaka/
Setup OpenStack PackStack
yum install -y openstack-packstack
failure: repodata/repomd.xml from openstack-mitaka: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/7/cloud/x86_64/openstack-mitaka/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Fix bằng cách
vi /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo
# đổi baseurl thành
http://mirror.neu.edu.cn/centos/7/cloud/$basearch/openstack-mitaka/
Error: Package: centos-release-openstack-mitaka-1-5.el7.noarch (openstack-mitaka)
Requires: centos-release-ceph-hammer
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Fix bằng cách
Chạy dòng trên sẽ bắt gặp lỗi
http://mirror.centos.org/centos/7/cloud/x86_64/openstack-mitaka/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
vi /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo
# đổi baseurl thành
http://mirror.neu.edu.cn/centos/7/cloud/$basearch/openstack-mitaka/
Tiếp theo sẽ bị lỗi về Ceph (vẫn là vấn đề version cũ)
Requires: centos-release-ceph-hammer
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Fix bằng cách
vi /etc/yum.repos.d/CentOS-Ceph-Hammer.repo
# đổi baseurl thành
http://mirror.neu.edu.cn/centos/7/storage/$basearch/ceph-hammer/
Tiến hành cài đặt OpenStack
packstack --allinone
192.168.168.128_ceilometer.pp: [ DONE ]
Applying 192.168.168.128_aodh.pp
192.168.168.128_aodh.pp: [ DONE ]
Applying 192.168.168.128_nagios.pp
Applying 192.168.168.128_nagios_nrpe.pp
192.168.168.128_nagios.pp: [ DONE ]
192.168.168.128_nagios_nrpe.pp: [ DONE ]
Applying Puppet manifests [ DONE ]
Finalizing [ DONE ]
**** Installation completed successfully ******
Additional information:
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
* File /root/keystonerc_admin has been created on OpenStack client host 192.168.168.128. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.168.128/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
* To use Nagios, browse to http://192.168.168.128/nagios username: nagiosadmin, password: 931ed527ae664521
* The installation log file is available at: /var/tmp/packstack/20190711-042748-EHS6Gc/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20190711-042748-EHS6Gc/manifests
Sau khi hoàn thành
- Mình sẽ login bằng account admin trong file ~/keystonerc_admin từ máy host (máy cài VMWare).
- File cấu hình (còn gọi là file answer, dùng để setup những lần sau) sẽ nằm ở ~/packstack-answers-xxxxxxxx-xxxxxx.txt
- Để cài đặt lại cùng với cấu hình cũ ta có thể dùng
packstack --answer-file ~/packstack-answers-xxxxxxxx-xxxxxx.txt
Giờ mình test thử tạo VM như thế nào, thử ngon chưa
- Image có sẵn: cirros
- Tạo cấu hình tối thiểu, attach vào public network card trong OpenStack (cũng không cần thiết có network)
Sau khi Init xong, thử login vào bằng NoVNC
Như vậy là mình đã setup được OpenStack version EOL, các verion cũ có thể setup tương tự.
EXP
- Vấn đề ở đây là repo doesn't exist, vì vậy ta phải tốn công tìm repo mới.
- Các version cũ tồn tại bug hoặc không tương thích với các dependencies mới.
- Packstack hỗ trợ setup OpenStack nhanh, dùng tốt trong các mô hình PoC (Proof of concept), không thích hợp dùng cho production; khi setup bị lỗi khó trace được lỗi.
Tham khảo
(1) https://docs.hortonworks.com/HDPDocuments/Cloudbreak/Cloudbreak-2.9.1/install-os/content/cb_supported-linux-distributions.html
(2) http://linuxpitstop.com/openstack-mitaka-rdo-on-centos-7/
Applying 192.168.168.128_aodh.pp
192.168.168.128_aodh.pp: [ DONE ]
Applying 192.168.168.128_nagios.pp
Applying 192.168.168.128_nagios_nrpe.pp
192.168.168.128_nagios.pp: [ DONE ]
192.168.168.128_nagios_nrpe.pp: [ DONE ]
Applying Puppet manifests [ DONE ]
Finalizing [ DONE ]
**** Installation completed successfully ******
Additional information:
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
* File /root/keystonerc_admin has been created on OpenStack client host 192.168.168.128. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.168.128/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
* To use Nagios, browse to http://192.168.168.128/nagios username: nagiosadmin, password: 931ed527ae664521
* The installation log file is available at: /var/tmp/packstack/20190711-042748-EHS6Gc/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20190711-042748-EHS6Gc/manifests
Sau khi hoàn thành
- Mình sẽ login bằng account admin trong file ~/keystonerc_admin từ máy host (máy cài VMWare).
- File cấu hình (còn gọi là file answer, dùng để setup những lần sau) sẽ nằm ở ~/packstack-answers-xxxxxxxx-xxxxxx.txt
- Để cài đặt lại cùng với cấu hình cũ ta có thể dùng
packstack --answer-file ~/packstack-answers-xxxxxxxx-xxxxxx.txt
Giờ mình test thử tạo VM như thế nào, thử ngon chưa
- Image có sẵn: cirros
- Tạo cấu hình tối thiểu, attach vào public network card trong OpenStack (cũng không cần thiết có network)
Sau khi Init xong, thử login vào bằng NoVNC
Như vậy là mình đã setup được OpenStack version EOL, các verion cũ có thể setup tương tự.
EXP
- Vấn đề ở đây là repo doesn't exist, vì vậy ta phải tốn công tìm repo mới.
- Các version cũ tồn tại bug hoặc không tương thích với các dependencies mới.
- Packstack hỗ trợ setup OpenStack nhanh, dùng tốt trong các mô hình PoC (Proof of concept), không thích hợp dùng cho production; khi setup bị lỗi khó trace được lỗi.
Tham khảo
(1) https://docs.hortonworks.com/HDPDocuments/Cloudbreak/Cloudbreak-2.9.1/install-os/content/cb_supported-linux-distributions.html
(2) http://linuxpitstop.com/openstack-mitaka-rdo-on-centos-7/
11/7/19
[How to] Extract rpm package on macOS
$ brew install rpm2cpio
$ rpm2cpio.pl ~/Downloads/rdo-release-mitaka-7.noarch.rpm | cpio -idmv
./etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
./etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization-RDO
./etc/yum.repos.d/rdo-qemu-ev.repo
./etc/yum.repos.d/rdo-release.repo
./etc/yum.repos.d/rdo-testing.repo
Đăng ký:
Nhận xét (Atom)











