Posts

Showing posts from 2017

NFS setup on Ubuntu (include fstab)

Image
Hi all, Past of month, I was too busy to write new blog, though I learn a lot of new things from work. During working, my customer asked me to build up the NFS (net file system) for them, so that they can fetch the file between computers by internal network. When It comes to NFS, you might think about SAMBA server, which can be mounted with CIFS. SAMBA is a service compatible with linux and window operating system. Since I just need to make linux OS computer connected, that is no need to build up a SAMBA server on my server PC. So let's start, First of all You have to install the nfs-server and nfs-common on server and client side. you can also check if the service is installed or not by : $ dpkg -l | grep nfs-kernel-server if not,  install the service on server and client : Server : # apt-get install nfs-kernel-server Client: # apt-get install nfs-common Now we can go through the step 2 -- setting up server. Server :     create the setting ...

Python : read / write file

Image
Hi guys, Yeah~ as you see on the top of this article, I start to learn python now! hah So... I gonna record some usage and some tutorial here about python. Okay~ Let's go! Python is good at text and data operating, so... the first thing before you parsing or do some modified to the file, you have to .... open and read / write the file!! open / close the file: file = open("filename", "type") file.close() As to type we can have : r : read w : write r+ : read/write a : append Read method :  To read all content in the file you can use... print file.read() Read line by line print file.readline() Write method : file.write("aaaa") file.write(str(123) + "\n") Open file and make it close automatically : with open("filename", "w") as file: file.write("Yes!!") Yeah~~ this is the first step ! Let's continue!                                       ...

Add a user to a group

Image
Hello, recently I'm too busy to write the blog, sorry about that. Today I gonna tried to add my user to the group. Since I using the Samba server, I set some file can be accessed by specific people. So... let's start. First of all, if you use groups , you will get something like this edwinlai@edwinlai:~$ groups edwinlai adm cdrom sudo dip plugdev lpadmin sambashare  To create a new group : edwinlai@edwinlai:~$ sudo groupadd my_group Now we want to add a user into the group! Also, you can add user to multiple group at once. edwinlai@edwinlai:~$ usermod -a -G group user edwinlai@edwinlai:~$ usermod -a -G group1,group2,group3 user And if you know what is primary group , we can change use's primary group by this command: edwinlai@edwinlai:~$ usermod -g group user Now you can use groups to see the groups include the user edwinlai@edwinlai:~$ groups user Finally, we want to create a new user and add it to the group we want. edwinlai@edwinlai:~$ usera...

Setting up git SSH key on ubuntu

Image
Yeah~~ Long time no see guys~ These day I was porting code from one computer to others by git. If you are familiar with it please don't be too serious, I'm just new of it. The problem is that typing user name and the password wasted me lots of time. Hence, I try not to use http but ssh link to the gitlab. (At least I don't need to type the username!! Especially it's an e-mail !) So ... the tutorial  to make ssh work on ubuntu to gitlab is below. 1. Generate a SSH key for ur computer. ssh-keygen -t rsa -C "yourmail@mail.com" -b 4096 2. Copy the ras key to clip board , you can copy by urself or apt-get install xclip tool to do it. xclip -sel clip < ~/.ssh/id_rsa.pub 3. And then you just have to add the key to the git setting.      If you used gitlab as I do you can go setting --> Deploy key 4. Then you Named the key and paste the key to the text edit , AND! check the "write access allowed" below!   5. After saved yo...

Spotify on linux

Image
Yeah Everybody, yup! you see the different logo here! That's Spotify~! Today I gonna talk about a easy topic. That is, how to install the Spotify in Linux~! Actually there is already a tutorial on there official site, but I still wanna record it. # 1. Add the Spotify repository signing key to be able to verify downloaded packages sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886 # 2. Add the Spotify repository echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list # 3. Update list of available packages sudo apt-get update # 4. Install Spotify sudo apt-get install spotify-client Um....ok, I just copy it, XD. see you next time~                                     provide

Custom Command

Image
Hi guys~! Today I got some issue on Ubuntu16.04. Although the Ubuntu is linux base, in ubuntu, we can't use root to login. Or u have to spend time to figure it out. So, the issue I met is that I tried to link serial port by some IDE, such as Qt, but the ttyUSB or ttyS0 ports are set as 550 permission. To use the port correctly u have to use root or sudo, but u can't run the Qt as root directly like Windows, in which u just right clicked and run as Administrator. Things u have to do is : cd /urpath/Qt/Tolls/QtCreator/bin sudo ./qtcreator So... the things I gonna teach u is ... how to write a custom command ~~ LOL, Sorry for tell a long story before the tutorial ahh. First of all, write the command u wanna use in txt or .sh whatever u want command : cd /urpath/Qt/Tolls/QtCreator/bin sudo ./qtcreator A common way to handle this is to use /bin directory, mkdir ~/bin put ur script in the folder mv yourfile ~/bin make sure u can execute it chmo...

Multiboot CentOS & Ubuntu

Image
Hi everybody, these day I tried to install multi os from on my desktop for work. However, the multi boot with Ubuntu and CentoOS will reach to the grub and grub2 conflicted problem. After few days studying and expirement, I finally figure out the way to fix the  conflict. Okay, now let's start. First of all you have to separate your disk to 2 partition, you might not try to install CentOS at first cause it Ubuntu won't detect the exist of the CentOS. Besides, I tried... many time and many ways. It will never make it to fix the Ubuntu grub to boot up the CentOS. So, Install Ubuntu first, I used Ubuntu 16.04 LTS Then install CentOS7 Now you might see the menu of CentOS's grub with centos and ubuntu in the list. However you will receive "can't find command linux & initrd" when you choose Ubuntu. That's because the centos used linuxefi and initrdefi for boot up. You can saw the command by press "E", and you will understand wh...

Linux Proxy setting

Image
Most of company have proxy server and have to route through it for access internet. Though the browser and the system can set proxy by UI, yum and apt need addition setting from the config file. Since CentOS and Ubuntu are both used wildly, I record the step for seeting up proxy config file for future used. Ubuntu 16.16 create a apt.conf file Acquire::http::proxy "http://proxy:port/"; Acquire::https::proxy "https://proxy:port/"; Acquire::ftp::proxy "ftp://proxy:port/"; Acquire::socks::proxy "socks://proxy:port/"; and put it in to the /etc/apt CentOS 7 modified /etc/yum.conf proxy=http://proxy:port and... Done~! This is the very simple tutorial for general situation. If u need more complex setting please google it. Thanks~