Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts

Tuesday, March 12, 2019

GNOME desktop on Centos 7 docker

https://linuxconfig.org/how-to-install-gui-gnome-on-centos-7-linux-system

open Git Bash

winpty docker run -ti --name centos centos bash
#run all the commands to install GNOME
exit
docker start centos
winpty docker exec -ti centos bash

#uptime gives you the number of days the HOST was up, not the container
uptime





Friday, January 18, 2019

Running Centos on Windows

once you have upgraded to Windows PRO, you can install https://docs.docker.com/docker-for-windows/install/ Docker for Windows

Then open your Git Bash shell and run:

winpty docker run --name centos -i -t -d centos

If the container is stopped, you can simply

docker start centos

and login again:

winpty docker exec -ti centos bash


So you can have a "REAL" Centos on Windows... cool...





Tuesday, November 6, 2018

Centos 7 gnome-shell high CPU on VirtualBox

top shows very high CPU usage. and UI is very very slow.

googling around, they say it's probably doing "software" rendering. it makes sense because CPU goes higher when I move something on the screen

in /var/log/Xorg.0.log I find this:

(EE) Failed to load module "vboxvideo" (module does not exist, 0)
(II) AIGLX: Screen 0 is not DRI2 capable
(EE) AIGLX: reverting to software rendering


To investigate, I run
sudo glxinfo
sudo lshw -C video
sudo yum list | grep libnvidia
sudo yum list | grep libegl


the output of glxinfo is

name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: Chromium
server glx version string: 1.3 Chromium
server glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, 
    GLX_EXT_texture_from_pixmap, GLX_SGIX_fbconfig
client glx vendor string: Chromium
client glx version string: 1.3 Chromium
client glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, 
    GLX_EXT_texture_from_pixmap, GLX_SGIX_fbconfig
GLX version: 1.3
GLX extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, 
    GLX_EXT_texture_from_pixmap, GLX_SGIX_fbconfig
OpenGL vendor string: Humper
OpenGL renderer string: Chromium
OpenGL version string: 2.1 Chromium 1.9
OpenGL shading language version string: 4.30 - Build 10.18.15.4248
OpenGL extensions:
    GL_ARB_depth_texture, GL_ARB_draw_buffers, GL_ARB_fragment_program, 
    GL_ARB_fragment_shader, GL_ARB_multisample, GL_ARB_multitexture, 
    GL_ARB_occlusion_query, GL_ARB_pixel_buffer_object, 
    GL_ARB_point_parameters, GL_ARB_point_sprite, GL_ARB_shader_objects, 
    GL_ARB_shading_language_100, GL_ARB_shadow, GL_ARB_texture_border_clamp, 
    GL_ARB_texture_compression, GL_ARB_texture_cube_map, 
    GL_ARB_texture_env_add, GL_ARB_texture_env_combine, 
    GL_ARB_texture_env_crossbar, GL_ARB_texture_env_dot3, 
    GL_ARB_texture_float, GL_ARB_texture_mirrored_repeat, 
    GL_ARB_texture_non_power_of_two, GL_ARB_texture_rectangle, 
    GL_ARB_transpose_matrix, GL_ARB_vertex_buffer_object, 
    GL_ARB_vertex_program, GL_ARB_vertex_shader, GL_ARB_window_pos, 
    GL_CR_bounding_box, GL_CR_cursor_position, GL_CR_head_spu_name, 
    GL_CR_performance_info, GL_CR_print_string, GL_CR_readback_barrier_size, 
    GL_CR_saveframe, GL_CR_server_id_sharing, GL_CR_server_matrix, 
    GL_CR_state_parameter, GL_CR_synchronization, GL_CR_tile_info, 
    GL_CR_tilesort_info, GL_CR_window_size, GL_EXT_blend_color, 
    GL_EXT_blend_equation_separate, GL_EXT_blend_func_separate, 
    GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_clip_volume_hint, 
    GL_EXT_compiled_vertex_array, GL_EXT_draw_range_elements, 
    GL_EXT_fog_coord, GL_EXT_framebuffer_blit, GL_EXT_framebuffer_object, 
    GL_EXT_multi_draw_arrays, GL_EXT_secondary_color, GL_EXT_shadow_funcs, 
    GL_EXT_stencil_two_side, GL_EXT_stencil_two_side, GL_EXT_stencil_wrap, 
    GL_EXT_texture3D, GL_EXT_texture_compression_s3tc, 
    GL_EXT_texture_edge_clamp, GL_EXT_texture_env_add, 
    GL_EXT_texture_env_combine, GL_EXT_texture_filter_anisotropic, 
    GL_EXT_texture_lod_bias, GL_EXT_texture_rectangle, GL_EXT_texture_sRGB, 
    GL_IBM_texture_mirrored_repeat, GL_NV_texgen_reflection, 
    GL_SGIS_generate_mipmap, GL_SGIS_texture_edge_clamp

1 GLX Visuals
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x021 24 tc  0  32  0 r  y y   8  8  8  8 .  .  0 24  8 16 16 16 16  0 0 None

1 GLXFBConfigs:
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x021 24 tc  0  32  0 r  y .   8  8  8  8 .  .  0 24  8  0  0  0  0  1 1 None

On VirtualBox, 3D acceleration is enabled.

So far no clue... the world of Linux Video drivers is amazingly complex... too complex for a simple human like me...



Tuesday, October 9, 2018

centos filesystem ntfs not configured in kernel

trying to install an external HD (Windows formatted) on a Centos box...

centos@localhost ~]$ sudo fdisk -l /dev/sdc2

Disk /dev/sdc2: 4000.7 GB, 4000650887168 bytes, 7813771264 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disk label type: dos
Disk identifier: 0x6e697373

This doesn't look like a partition table
Probably you selected the wrong device.

     Device Boot      Start         End      Blocks   Id  System
/dev/sdc2p1   ?  1936269394  3772285809   918008208   4f  QNX4.x 3rd part
Partition 1 does not start on physical sector boundary.
/dev/sdc2p2   ?  1917848077  2462285169   272218546+  73  Unknown
Partition 2 does not start on physical sector boundary.
/dev/sdc2p3   ?  1818575915  2362751050   272087568   2b  Unknown
Partition 3 does not start on physical sector boundary.
/dev/sdc2p4   ?  2844524554  2844579527       27487   61  SpeedStor
Partition 4 does not start on physical sector boundary.

Partition table entries are not in disk order
[centos@localhost ~]$ 


sudo yum install epel-release

Package epel-release-7-11.noarch already installed and latest version
Nothing to do


find /lib/modules/ | grep ntfs


nothing is found!

sudo yum install ntfs-3g -y



and now it works! Great! New mountpoint is /run/media/centos/Seagate\ Expansion\ Drive/


REF:

https://www.rootusers.com/how-to-mount-a-windows-ntfs-disk-in-linux/




Wednesday, May 23, 2018

sudo systemctl hibernate

on Centos, I was trying to hibernate my machine:

sudo systemctl hibernate

A dependency job for hibernate.target failed. See 'journalctl -xe' for details.

journalctl -xe


Failed to write mode to /sys/power/disk: Operation not permitted

https://ask.fedoraproject.org/en/question/41118/f20-unable-to-hibernate-syspowerdisk-disabled/


I removed "safe boot" option in the BIOS settings, and now I am able to hibernate! Amazing!


See also this https://www.thegeekdiary.com/centos-rhel-7-shutting-down-suspending-or-rebooting-commands-systemctl/, maybe "suspend" is cheaper safer and faster than hibernate...



Thursday, May 10, 2018

Installing VirtualBox Guest Additions on Centos7

Apparently in latest VB releases the Guest Additions have to be built directly on the image.

This of course is a pain, because OOTB the Centos7 image doesn't contain the development tools. SO you get a message like "building the main Guest Additions module Failed"


https://unix.stackexchange.com/questions/37866/how-to-solve-building-the-main-guest-additions-module-failed


this fixed the problem:

sudo yum install gcc kernel-devel-$(uname -r)

sudo su -
cd /run/media/centos/VBox_GAs_5.2.12/
./autorun.sh





Friday, January 5, 2018

CentOS install JDK

which java
java -version
ls -ltr /usr/bin/java
ls -ltr /etc/alternatives/java


sudo yum update

yum list installed | grep "java"

sudo yum install java-1.8.0-openjdk-devel

cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64/

sudo ln -sf /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64/bin/java /etc/alternatives/java





Gnome hotcorner: most annoying unwanted feature ever

I have moved away from Windows because I was really fed up with Microsoft. Installed Centos with Gnome. To discover that Gnome is even worse!

If by mistake you put the mouse on the screen border, all your open windows stack up and you are forced to click back on a thumbnail to resume work.

And apparently, after 20 minutes googling, there is no easy way to disable this unasked-for, unwanted trollish feature.

Even in Applications/Utilities/Tweak tools I could not find an option to disable this stupid crap.

YAGNI: you will never need this stupid trick, then why enabling it by default? I simply hate UIs overloaded with hidden features..... KEEP IT SIMPLE !



Saturday, December 16, 2017

Getting started with Ansible in Docker

Since OpenShift uses Ansible, and also since I hate Puppet, I love Python, Ansible is based on Python and I always wanted to learn a Provisioning tool other from Puppet to prove that Puppet folks are losers...
and since Ansible can nuke your environment if used incorrectly....

I am installing Ansible in a docker Centos machine, so I can nuke it at my will!

docker pull centos
#here nothing happens
docker run centos
docker container ls
docker run -i -t centos
yum install man
yum install ansible
exit
#note down the container id, it's displayed after the root@ prompt , like in root@61d50a06c86c
docker commit 61d50a06c86c centosansible

at this point I can easily run:
docker run -i -t centosansible

and if I do
docker images | grep centos
centosansible latest 2766690643c3 9 minutes ago 353MB
centos latest 3fa822599e10 2 weeks ago 204MB

I see that my image is there (the 353MB size include all the layers from centos image, which are NOT duplicated, so the real additional space is only 353-204=149 MB


http://docs.ansible.com/ansible/latest/intro_installation.html


ansible --version
ansible 2.4.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]


ansible localhost -a /bin/date

ansible localhost -m ping



This is a nice tutorial - skip first 13 minutes, then you have 20 minutes of theory, then some interesting Ansible examples








quick nfs mount on CentOS

#find your ip
ifconfig
#create folder to share
sudo mkdir -p /drbd/main/shared
#who cares about security
sudo chmod -R 777 /drbd/
#create folder where local files should appear
mkdir -p /home/centos/ocpnfs
sudo vi /etc/exports
#enter this in /etc/exports
/drbd/main/shared/ 10.0.2.15(rw)
#end of /etc/exports
sudo systemctl restart nfs
sudo exportfs -v
sudo mount -t nfs 10.0.2.15:/drbd/main/shared/ /home/centos/ocpnfs
touch /home/centos/ocpnfs/pippo.txt



Saturday, December 9, 2017

docker-compose

Install docker-compose on CentOS. Digital Ocean tutorials are very good:

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-centos-7


sudo yum install epel-release
sudo yum install -y python-pip


if you get

"Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
"

just do "ps -ef | grep PackageKit", find the PID and do "sudo kill -9 PID"


sudo pip install --upgrade pip

sudo pip install docker-compose
sudo yum upgrade python*


docker-compose



Awesome quick hands-on php tutorial on docker-compose



first do:
sudo pip3.6 install flask
sudo pip3.6 install flask_restful


cd
mkdir jakewright; cd jakewright
mkdir product; cd product

you should have this tree:
~
~/jakewright
~/jakewright/product

make sure you are in ~/jakewright/product :

cat api.py
from flask import Flask
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)

class Product(Resource):
    def get(self):
        return {
            'products' : ['Ice Cream', 'Chocolate', 'Fruit']
        }

api.add_resource(Product, '/')

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=9080, debug=True)

python3.6 api.py

http://localhost:9080/


cat Dockerfile
FROM python:3-onbuild
COPY . /usr/src/app
CMD ["python", "api.py"]



cat requirements.txt
flask
flask_restful


docker build . -t jakewright
-> Successfully tagged jakewright:latest
docker images
docker run -p 9080:9080 jakewright


now in ~/jakewright folder:
cat docker-compose.yml

version: '3'

services:
product-service:
build: ./product
volumes:
- ./product:/usr/src/app
ports:
- 9080:9080


(leaving the second part for now....)

docker-compose up -d
docker-compose stop

your service should now be equally available, in an image called jakewright_product-service


User Manual for Dockerfile https://docs.docker.com/engine/reference/builder/#usage



PS another GREAT video by Jake Wright is Learning CSS https://www.youtube.com/watch?v=0afZj1G0BIE , and don't forget Learning Docker https://www.youtube.com/watch?v=YFl2mCHdv24





Wednesday, November 22, 2017

CentOS 7 install Python 3

CentOS 7 comes with some old version of Python 2 - which is going EOL in a couple of years.

Also, Django recommends Python 3 https://www.djangoproject.com/download/

#this will probably install a new version of docker, and you will likely lose all your containers !!!
sudo yum -y update
#better to reboot now

sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm

sudo yum -y install python36u

#check if installed
python3.6 -V

#beware! old python is still installed, if you run "python" you get the 2 version

https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7


https://www.djangoproject.com/download/

sudo yum -y install python36u-pip





Tuesday, November 14, 2017

Magic: convert CentOS 7 to Oracle Linux

I found this post https://www.digitalocean.com/community/questions/how-can-i-install-oracle-11g


curl -O https://linux.oracle.com/switch/centos2ol.sh
chmod 777 centos2ol.sh
sudo sh -c ./centos2ol.sh

sudo yum distro-sync

I get this:


Transaction check error:
file /usr/lib64/gnome-documents/girepository-1.0/Gd-1.0.typelib from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64
file /usr/lib64/gnome-documents/girepository-1.0/GdPrivate-1.0.typelib from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64
file /usr/lib64/gnome-documents/libgd.so from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64
file /usr/lib64/gnome-documents/libgdprivate-1.0.so from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64
file /usr/share/glib-2.0/schemas/org.gnome.Documents.enums.xml from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64
file /usr/share/gnome-documents/getting-started/C/gnome-documents-getting-started.pdf from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64
file /usr/share/gnome-documents/gir-1.0/Gd-1.0.gir from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64
file /usr/share/gnome-documents/gir-1.0/GdPrivate-1.0.gir from install of gnome-documents-3.14.3-3.el7.x86_64 conflicts with file from package gnome-documents-libs-3.22.2-5.el7.x86_64


sudo yum install oracle-rdbms-server-11gR2-preinstall

sudo reboot now

At this point, you can try to install Oracle DB http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html

Friday, October 20, 2017

VirtualBox shared folder on Linux Centos guest and Windows host

my main Linux user is "centos".

in VirtualBox, right-click on your VM, Settings, Shared Folder, create an entry with Folder Path = d:\pierre\pvshared and Folder Name = pvshared , check "auto-mount" and "make permanent"

Make sure you have the latest VBoxAdditions installed:

cd /run/media/centos/VBOXADDITIONS_5.1.30_118389/
sudo ./autorun.sh

#group vboxsf should already exist, so this should fail:
sudo groupadd vboxsf
sudo usermod -a -G vboxsf centos

reboot!

login again with your user (centos)

id
uid=1000(centos) gid=1000(centos) groups=1000(centos),983(vboxsf) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

cd /media/sf_pvshared
touch pippo.txt

you should see the file pippo.txt on your d:\pierre\pvshared folder in Windows

I have also done

sudo chmod 777 /media/sf_pvshared

but I don't think it's required once the centos user is assigned to vboxsf group



Saturday, September 23, 2017

Installing Docker on CentOS 7

from the excellent guide https://docs.docker.com/engine/installation/linux/docker-ce/centos/

sudo yum remove docker docker-common docker-selinux docker-engine
sudo yum install -y yum-utils   device-mapper-persistent-data   lvm2
sudo yum-config-manager --add-repo  https://download.docker.com/linux/centos/docker-ce.repo
sudo yum-config-manager --enable docker-ce-edge
sudo yum-config-manager --enable docker-ce-test
sudo yum install docker-ce
yum list docker-ce.x86_64  --showduplicates | sort -r
sudo systemctl start docker
sudo docker run hello-world
sudo docker run -it ubuntu bash
sudo yum makecache fast
sudo groupadd docker
echo $USER
sudo usermod -aG docker $USER
#(perform logout/login here)
groups
#"centos docker"
sudo systemctl enable docker
#"Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service."
sudo chkconfig docker on
env | grep DOCKER_HOST
#DOCKER_HOST should not be defined if you want to connect to local daemon
#to restart daemon:
sudo service docker restart




useful commands (from the presentation below):



https://www.youtube.com/watch?v=VeiUjkiqo9E&feature=youtu.be
docker ps -a
docker version
docker info
docker images

docker run ubuntu echo "hello world"

docker run -i -t ubuntu
exit

docker diff 82af4da88bd7
docker rm 042cbb043587

docker run -d ubuntu /bin/sh -c "while true; do echo hello world; date; sleep 2; done"
docker logs 7939ad46d57c
docker attach 7939ad46d57c
docker stop 7939ad46d57c

docker inspect 7939ad46d57c

docker commit -m "installed apache" 7939ad46d57c mynamespace/myimage
docker images

#login into https://hub.docker.com
docker login
docker push mynamespace/myimage

docker rmi 77bde6a39eda

#execute the Dockerfile in myfolder and build a new image
docker build -t mynamespace/myimage github.com/myrepo/myfolder

#run assigning a non default port
docker run -d -p :8000 mynamespace/myimage








here the link to shipyard https://github.com/shipyard/shipyard